示例#1
0
            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);
            }
示例#2
0
            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);
            }