示例#1
0
        public void FileUnit_RollbackDelete_ReturnFalse()
        {
            // Arrange
            var unit = new FileUnit();

            unit.Delete(this.DeleteFilePath);

            // Act
            unit.Commit();
            unit.Rollback();

            // Assert
            Assert.IsTrue(File.Exists(this.DeleteFilePath));
        }
示例#2
0
        public void FileUnit_RollbackCopy_ReturnTrue()
        {
            // Arrange
            var unit = new FileUnit();

            unit.Copy(this.CopyFilePath, this.CopybleFilePath, true);

            // Act
            unit.Commit();
            unit.Rollback();

            // Assert
            Assert.IsTrue(File.Exists(this.CopyFilePath) &&
                          !File.Exists(this.CopybleFilePath));
        }
示例#3
0
        public void FileUnit_RollbackMove_ReturnTrue()
        {
            // Arrange
            var unit = new FileUnit();

            unit.Move(this.MoveFilePath, this.MovebleFilePath);

            // Act
            unit.Commit();
            unit.Rollback();

            // Assert
            Assert.IsTrue(!File.Exists(this.MovebleFilePath) &&
                          File.Exists(this.MoveFilePath));
        }
示例#4
0
        public void FileUnit_RollbackWriteAllText_ReturnTrue()
        {
            // Arrange
            var unit = new FileUnit();

            unit.WriteAllText(this.WriteFilePath, this.AddedContent);

            // Act
            unit.Commit();
            unit.Rollback();

            // Assert
            string textInWriteFile = File.ReadAllText(this.WriteFilePath);

            Assert.AreEqual(textInWriteFile, this.Content);
        }