public void Should_Delete_File() { // Given var fixture = new FileDeleteFixture(); // When FileAliases.DeleteFile(fixture.Context, fixture.Paths[0]); // Then fixture.Files[0].Received(1).Delete(); }
public void Should_Make_Relative_File_Path_Absolute() { // Given var fixture = new FileDeleteFixture(); // When FileAliases.DeleteFile(fixture.Context, "file1.txt"); // Then fixture.FileSystem.Received(1).GetFile(Arg.Is <FilePath>( p => p.FullPath == "/Working/file1.txt")); }
public void Should_Throw_If_File_Path_Is_Null() { // Given var context = Substitute.For <ICakeContext>(); // When var result = Record.Exception(() => FileAliases.DeleteFile(context, null)); // Then Assert.IsArgumentNullException(result, "filePath"); }
public void Should_Throw_If_Context_Is_Null() { // Given var filePath = new FilePath("./file.txt"); // When var result = Record.Exception(() => FileAliases.DeleteFile(null, filePath)); // Then Assert.IsArgumentNullException(result, "context"); }
public void Should_Throw_If_File_Do_Not_Exist() { // Given var fixture = new FileDeleteFixture(); // When var result = Record.Exception(() => FileAliases.DeleteFile(fixture.Context, "/file.txt")); // Then Assert.IsType <FileNotFoundException>(result); Assert.Equal("The file '/file.txt' do not exist.", result.Message); }