Пример #1
0
        private static void TestUndoFileReader()
        {
            UndoFileReader reader = new UndoFileReader(
                VirtualDrive.VirtualFileName("TestUndoFileWriter.txt"));

            UnitTest.Test(reader.NumCommands() == 4);

            for (int i = 3; i >= 0; i--)
            {
                SerializedCommand cmd = reader.CommandByIndex(i);
                UnitTest.Test(cmd.Target == typeof(TestClass).FullName);
                UnitTest.Test(cmd.Operation == "TestUndoFileWriter");

                UnitTest.Test(cmd.Data.Length == i);
                for (int j = 0; j < i; j++)
                {
                    UnitTest.Test(cmd.Data[j] == "line" + j);
                }
            }

            for (int i = 0; i < 4; i++)
            {
                SerializedCommand cmd = reader.CommandByIndex(i);
                UnitTest.Test(cmd.Target == typeof(TestClass).FullName);
                UnitTest.Test(cmd.Operation == "TestUndoFileWriter");

                UnitTest.Test(cmd.Data.Length == i);
                for (int j = 0; j < i; j++)
                {
                    UnitTest.Test(cmd.Data[j] == "line" + j);
                }
            }

            reader.Close();
        }
Пример #2
0
 public void Close()
 {
     if (Reader != null)
     {
         Reader.Close();
         Reader = null;
     }
 }
Пример #3
0
 public UndoFilePlayer(string fileName)
 {
     Reader = new UndoFileReader(fileName);
 }