public void FileIsNotDeletedIfDeletedAfterMergeIsNotSet() { // Initialise the test var fileSystem = this.mocks.Create <IFileSystem>(MockBehavior.Strict).Object; var file = new FileInfo(this.filename); Mock.Get(fileSystem).Setup(_fileSystem => _fileSystem.FileExists(file.FullName)).Returns(true); // Run the test var result = new FileTaskResult(file, false, fileSystem); result.CleanUp(); // Check the results this.mocks.VerifyAll(); }
public void FileIsNotDeletedIfDeletedAfterMergeIsNotSet() { // Initialise the test var fileSystem = this.mocks.StrictMock <IFileSystem>(); var file = new FileInfo(this.filename); SetupResult.For(fileSystem.FileExists(file.FullName)).Return(true); // Run the test this.mocks.ReplayAll(); var result = new FileTaskResult(file, false, fileSystem); result.CleanUp(); // Check the results this.mocks.VerifyAll(); }
public void DeleteAfterMergeDeletesTheFile() { // Initialise the test var fileSystem = this.mocks.StrictMock <IFileSystem>(); var file = new FileInfo(this.filename); SetupResult.For(fileSystem.FileExists(file.FullName)).Return(true); Expect.Call(() => { fileSystem.DeleteFile(file.FullName); }); // Run the test this.mocks.ReplayAll(); var result = new FileTaskResult(file, true, fileSystem); result.CleanUp(); // Check the results this.mocks.VerifyAll(); }