-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…-injection (GH-181) Add Dependency Injection
- Loading branch information
Showing
81 changed files
with
4,121 additions
and
1,054 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Source/GitReleaseManager.Core.Tests/Commands/AddAssetsCommandTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="AddAssetsCommandTests.cs" company="GitTools Contributors"> | ||
// Copyright (c) 2015 - Present - GitTools Contributors | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using GitReleaseManager.Core.Commands; | ||
using GitReleaseManager.Core.Options; | ||
using NSubstitute; | ||
using NUnit.Framework; | ||
using Serilog; | ||
using Shouldly; | ||
|
||
namespace GitReleaseManager.Core.Tests.Commands | ||
{ | ||
[TestFixture] | ||
public class AddAssetsCommandTests | ||
{ | ||
private IVcsService _vcsService; | ||
private ILogger _logger; | ||
private AddAssetsCommand _command; | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
_vcsService = Substitute.For<IVcsService>(); | ||
_logger = Substitute.For<ILogger>(); | ||
_command = new AddAssetsCommand(_vcsService, _logger); | ||
} | ||
|
||
[Test] | ||
public async Task Should_Execute_Command() | ||
{ | ||
var options = new AddAssetSubOptions | ||
{ | ||
RepositoryOwner = "owner", | ||
RepositoryName = "repository", | ||
TagName = "0.1.0", | ||
AssetPaths = new List<string>(), | ||
}; | ||
|
||
_vcsService.AddAssetsAsync(options.RepositoryOwner, options.RepositoryName, options.TagName, options.AssetPaths). | ||
Returns(Task.CompletedTask); | ||
|
||
var result = await _command.Execute(options).ConfigureAwait(false); | ||
result.ShouldBe(0); | ||
|
||
await _vcsService.Received(1).AddAssetsAsync(options.RepositoryOwner, options.RepositoryName, options.TagName, options.AssetPaths).ConfigureAwait(false); | ||
_logger.Received(1).Information(Arg.Any<string>()); | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
Source/GitReleaseManager.Core.Tests/Commands/CloseCommandTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="CloseCommandTests.cs" company="GitTools Contributors"> | ||
// Copyright (c) 2015 - Present - GitTools Contributors | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using System.Threading.Tasks; | ||
using GitReleaseManager.Core.Commands; | ||
using GitReleaseManager.Core.Options; | ||
using NSubstitute; | ||
using NUnit.Framework; | ||
using Serilog; | ||
using Shouldly; | ||
|
||
namespace GitReleaseManager.Core.Tests.Commands | ||
{ | ||
[TestFixture] | ||
public class CloseCommandTests | ||
{ | ||
private IVcsService _vcsService; | ||
private ILogger _logger; | ||
private CloseCommand _command; | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
_vcsService = Substitute.For<IVcsService>(); | ||
_logger = Substitute.For<ILogger>(); | ||
_command = new CloseCommand(_vcsService, _logger); | ||
} | ||
|
||
[Test] | ||
public async Task Should_Execute_Command() | ||
{ | ||
var options = new CloseSubOptions | ||
{ | ||
RepositoryOwner = "owner", | ||
RepositoryName = "repository", | ||
Milestone = "0.1.0", | ||
}; | ||
|
||
_vcsService.CloseMilestoneAsync(options.RepositoryOwner, options.RepositoryName, options.Milestone) | ||
.Returns(Task.CompletedTask); | ||
|
||
var result = await _command.Execute(options).ConfigureAwait(false); | ||
result.ShouldBe(0); | ||
|
||
await _vcsService.Received(1).CloseMilestoneAsync(options.RepositoryOwner, options.RepositoryName, options.Milestone).ConfigureAwait(false); | ||
_logger.Received(1).Information(Arg.Any<string>(), options.Milestone); | ||
} | ||
} | ||
} |
Oops, something went wrong.