public void TestRead() { var sys = new VersioningSystem(TWDir.Test.CreateSubdirectory("Versioning\\TestRead")); using (var wr = new StreamWriter(sys.OpenWrite("TestFile.txt"))) { wr.WriteLine("Test Line!"); } sys.Commit("First commit"); using (var wr = new StreamWriter(sys.OpenWrite("TestFile.txt"))) { wr.WriteLine("Test Line!"); } using (var wr = new StreamWriter(sys.OpenWrite("TestFile2.txt"))) { wr.WriteLine("Test Line2!"); } sys.Commit("Test!"); using (var s = new StreamReader(sys.OpenFileRead("TestFile2.txt"))) { Assert.AreEqual(s.ReadLine(), "Test Line2!"); } using (var s = new StreamReader(sys.OpenFileRead("TestFile.txt"))) { Assert.AreEqual(s.ReadLine(), "Test Line!"); } }
public void TestWriteWorkingCopy() { var sys = new VersioningSystem(TWDir.Test.CreateSubdirectory("Versioning\\TestWorking")); using (var wr = new StreamWriter(sys.OpenWrite("TestFile.txt"))) { wr.WriteLine("Test Line!"); } }
public void TestCommit() { var sys = new VersioningSystem(TWDir.Test.CreateSubdirectory("Versioning\\TestCommit")); using (var wr = new StreamWriter(sys.OpenWrite("TestFile.txt"))) { wr.WriteLine("Test Line!"); } sys.Commit("First commit"); using (var wr = new StreamWriter(sys.OpenWrite("TestFile.txt"))) { wr.WriteLine("Test Line! Changed!!"); } sys.Commit("Change the one file that exists!"); }
public void TestCommitRedundant() { var sys = new VersioningSystem(TWDir.Test.CreateSubdirectory("Versioning\\TestCommitRedundant")); using (var wr = new StreamWriter(sys.OpenWrite("TestFile.txt"))) { wr.WriteLine("Test Line!"); } sys.Commit("First commit"); using (var wr = new StreamWriter(sys.OpenWrite("TestFile.txt"))) { wr.WriteLine("Test Line!"); } using (var wr = new StreamWriter(sys.OpenWrite("TestFile2.txt"))) { wr.WriteLine("Test Line2!"); } sys.Commit("Test!"); }
public void TestCommitEmpty() { var sys = new VersioningSystem(TWDir.Test.CreateSubdirectory("Versioning\\TestCommitEmpty")); sys.Commit("Should Crash!"); }