public void SimpleLocalDeletion() { string strInitial = "This is a failed test."; string strExpectedResult = "This is a test."; DocTransform docTransform = new DocTransform(0); docTransform.Append(DocTransform.Delete(0, 10, 7)); string strResult = docTransform.Apply(strInitial); Assert.AreEqual(strExpectedResult, strResult); }
public void MultipleLocalOperations() { string strInitial = "This is a failed test."; string strExpectedResult = "This is a successful test."; DocTransform docTransform = new DocTransform(0); docTransform.Append(DocTransform.Delete(0, 10, 4)); docTransform.Append(DocTransform.Insert(0, 10, "success")); docTransform.Append(DocTransform.Insert(0, 17, "ful ")); docTransform.Append(DocTransform.Delete(0, 21, 3)); string strResult = docTransform.Apply(strInitial); Assert.AreEqual(strExpectedResult, strResult); }
public void ReplaceTest02() { string strInitial = "TestString"; string strExpectedResult = "TsstString"; DocTransform remoteTransform = new DocTransform(0); remoteTransform.Append(DocTransform.Insert(0, 1, "h")); remoteTransform.Append(DocTransform.Delete(0, 2, 1)); DocTransform localTransform = new DocTransform(0); localTransform.Append(DocTransform.Insert(1, 1, "s")); localTransform.Append(DocTransform.Delete(1, 2, 1)); localTransform.Transform(remoteTransform); string strResult = localTransform.Apply(remoteTransform.Apply(strInitial)); Assert.AreEqual(strExpectedResult, strResult); Assert.AreEqual(localTransform.ParentStateIndex, 1); }