forked from GitTools/GitReleaseManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLabelCommandTests.cs
45 lines (39 loc) · 1.33 KB
/
LabelCommandTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 LabelCommandTests
{
private IVcsService _vcsService;
private ILogger _logger;
private LabelCommand _command;
[SetUp]
public void Setup()
{
_vcsService = Substitute.For<IVcsService>();
_logger = Substitute.For<ILogger>();
_command = new LabelCommand(_vcsService, _logger);
}
[Test]
public async Task Should_Execute_Command()
{
var options = new LabelSubOptions
{
RepositoryOwner = "owner",
RepositoryName = "repository",
};
_vcsService.CreateOrUpdateLabelsAsync(options.RepositoryOwner, options.RepositoryName)
.Returns(Task.CompletedTask);
var result = await _command.Execute(options).ConfigureAwait(false);
result.ShouldBe(0);
await _vcsService.Received(1).CreateOrUpdateLabelsAsync(options.RepositoryOwner, options.RepositoryName).ConfigureAwait(false);
_logger.Received(1).Information(Arg.Any<string>());
}
}
}