public void DoNothing_WhenTheFileDoesNotExists() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("DeleteFileAction.CustAct")); FileInfo fileToDelete = new FileInfo(action.FullPath); var finalResult = Tools.GetReturnCodeAction(); // Act if (fileToDelete.Exists) { fileToDelete.Delete(); fileToDelete.Refresh(); Assert.IsFalse(fileToDelete.Exists); } action.Run(ref finalResult); fileToDelete.Refresh(); // Assert Assert.IsFalse(fileToDelete.Exists); }
public void DeleteTheFile_WhenItExists() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("DeleteFileAction.CustAct")); FileInfo fileToDelete = new FileInfo(action.FullPath); var finalResult = Tools.GetReturnCodeAction(); // Act if (!fileToDelete.Exists) { StreamWriter writer = new StreamWriter(action.FullPath); writer.Write("test"); writer.Close(); fileToDelete.Refresh(); Assert.IsTrue(fileToDelete.Exists); } action.Run(ref finalResult); fileToDelete.Refresh(); // Assert Assert.IsFalse(fileToDelete.Exists); }