public void TestAddTracking() { var filenames = new List<string>() { "ReadyRedlineDocumentTrackingTest.doc", "NoPassword.docx", "RemovePassword.docx", "password_removed.docx", "Sample Original Document _ Office 2010 SP2.docx", "Sample Original Document _ Office 2013 Format.docx", "Sample Original Document _ Strict Open XML.docx" }; filenames.ForEach(delegate(string x) { string testfile = Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(Path.Combine(_path, x)); string tempfile = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetFileName(testfile)); System.IO.File.Copy(testfile, tempfile, true); var intelligentDocument = new IntelligentDocument(); intelligentDocument.SetFileName(tempfile); Assert.False(intelligentDocument.IsDocumentBeingTracked()); intelligentDocument.AddDocumentTrackingId(); Assert.True(intelligentDocument.IsDocumentBeingTracked()); }); }
public void TestIsDocumentModifiedReturnsNullIfNoCheckSum() { string testfile = Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(Path.Combine(_path, "ReadyRedlineDocumentTrackingTest.doc")); string tempfile = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetFileName(testfile)); System.IO.File.Copy(testfile, tempfile, true); var intelligentDocument = new IntelligentDocument(); intelligentDocument.SetFileName(tempfile); Assert.IsNull(intelligentDocument.IsDocumentModified()); }
public void TestGetTracking() { var filenames = new List<Tuple<string, string>>() { new Tuple<string, string>("Original.docx", "68f59b66-f335-45f0-9afe-58bedcc9e32d") }; filenames.ForEach(delegate(Tuple<string, string> x) { string testfile = Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(Path.Combine(_path, x.Item1)); string tempfile = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetFileName(testfile)); System.IO.File.Copy(testfile, tempfile, true); var intelligentDocument = new IntelligentDocument(); intelligentDocument.SetFileName(tempfile); Assert.IsTrue(intelligentDocument.IsDocumentBeingTracked()); Assert.IsTrue(String.Compare(x.Item2, intelligentDocument.GetDocumentTrackingId(), true) == 0); }); }