private void AssertEventArgsCorrect(ProgressEventArgs actual, EventType et, LocalNamespace ns, LocalTopic topic, Status oldStatus, Status newStatus, string message) { Assert.AreEqual(et, actual.EventType, "Checking that event types are equivalent for " + message); Assert.AreEqual(ns.Name, actual.Namespace.Name, "Checking that namespaces are equivalent for " + message); Assert.AreEqual(topic.Name, actual.Topic.Name, "Checking that topics are equivalent for " + message); Assert.AreEqual(oldStatus, actual.OldStatus, "Checking that old statuses are equivalent for " + message); Assert.AreEqual(newStatus, actual.NewStatus, "Checking that new statuses are equivalent for " + message); }
public override void SetUp() { base.SetUp(); target = new ProgressCallbackTestTarget(); sync.Progress += new ProgressCallback(target.OnProgress); sync.Initialize(); sync.Update(); string topicname = "TwoTopic"; theTopic = sync.Namespaces["A"].Topics[topicname]; SetUpConflict(theTopic); sync.SyncToLocal(); sync.SyncToRemote(); Assert.AreEqual(Status.InConflict, theTopic.Status, "Checking that status is now 'InConflict'"); localContents = Utilities.GetTopicContent(theTopic); remoteContents = proxy.GetLatestText(theTopic.Namespace.Name, theTopic.Name); }
public string ResolveConflict(LocalTopic localContents, string remoteContents) { if (mode == ResolutionMode.Cancel) { return null; } else if (mode == ResolutionMode.Concatenate) { return localContents.ReadContents() + remoteContents; } else if (mode == ResolutionMode.KeepLocal) { return localContents.ReadContents(); } else if (mode == ResolutionMode.KeepRemote) { return remoteContents; } else { throw new Exception("Unrecognized mode " + mode.ToString()); } }
protected void SetUpConflict(LocalTopic topic) { string content = "A change at " + DateTime.Now.ToString(); UnitTests.AppendToTopic(topic, content); proxy.Populate("A", topic.Name, topic.RepositoryVersion + "PlusOne", content); }