-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathAddAssetsCommandTests.cs
54 lines (47 loc) · 1.8 KB
/
AddAssetsCommandTests.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
46
47
48
49
50
51
52
53
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>());
}
}
}