forked from scriptcs/scriptcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCleanCommandTests.cs
More file actions
33 lines (27 loc) · 1.11 KB
/
CleanCommandTests.cs
File metadata and controls
33 lines (27 loc) · 1.11 KB
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
using Moq;
using Ploeh.AutoFixture.Xunit;
using ScriptCs.Command;
using ScriptCs.Contracts;
using Xunit.Extensions;
namespace ScriptCs.Tests
{
public class CleanCommandTests
{
public class ExecuteMethod
{
[Theory, ScriptCsAutoData]
public void ShouldDeletePackagesFolder([Frozen] Mock<IFileSystem> fileSystem, CommandFactory factory)
{
// Arrange
var args = new ScriptCsArgs { Clean = true };
fileSystem.Setup(i => i.DirectoryExists(It.Is<string>(x => x.Contains(Constants.PackagesFolder)))).Returns(true);
fileSystem.Setup(i => i.GetWorkingDirectory(It.IsAny<string>())).Returns("c:\\");
// Act
factory.CreateCommand(args, new string[0]).Execute();
// Assert
fileSystem.Verify(i => i.DirectoryExists(It.Is<string>(x => x.Contains(Constants.PackagesFolder))), Times.Once());
fileSystem.Verify(i => i.DeleteDirectory(It.Is<string>(x => x.Contains(Constants.PackagesFolder))), Times.Once());
}
}
}
}