Пример #1
0
        public void op_Revert_whenUnidirectional()
        {
            using (var temp = new TempDirectory())
            {
                var source = temp.Info.ToFile("from.txt");
                source.CreateNew("example");
                var destination = temp.Info.ToFile("to.txt");

                var obj = new FileMoveCommand(source, destination, true);

                Assert.True(obj.Act());
                Assert.False(obj.Undo);

                Assert.True(obj.Revert());
                Assert.Equal("example", destination.ReadToEnd());
            }
        }
Пример #2
0
        public void op_Revert()
        {
            using (var temp = new TempDirectory())
            {
                var source = temp.Info.ToFile("from.txt");
                source.CreateNew("example");
                var destination = temp.Info.ToFile("to.txt");

                var obj = new FileMoveCommand(source, destination);

                Assert.True(obj.Act());
                source.Refresh();
                Assert.False(source.Exists);
                Assert.True(destination.Exists);

                Assert.True(obj.Revert());
                source.Refresh();
                Assert.True(source.Exists);
                destination.Refresh();
                Assert.False(destination.Exists);
            }
        }
Пример #3
0
        public void op_Revert_whenUnidirectional()
        {
            using (var temp = new TempDirectory())
            {
                var source = temp.Info.ToFile("from.txt");
                source.CreateNew("example");
                var destination = temp.Info.ToFile("to.txt");

                var obj = new FileMoveCommand(source, destination, true);

                Assert.True(obj.Act());
                Assert.False(obj.Undo);

                Assert.True(obj.Revert());
                Assert.Equal("example", destination.ReadToEnd());
            }
        }
Пример #4
0
        public void op_Revert()
        {
            using (var temp = new TempDirectory())
            {
                var source = temp.Info.ToFile("from.txt");
                source.CreateNew("example");
                var destination = temp.Info.ToFile("to.txt");

                var obj = new FileMoveCommand(source, destination);

                Assert.True(obj.Act());
                source.Refresh();
                Assert.False(source.Exists);
                Assert.True(destination.Exists);

                Assert.True(obj.Revert());
                source.Refresh();
                Assert.True(source.Exists);
                destination.Refresh();
                Assert.False(destination.Exists);
            }
        }