/// <summary> /// Merge method /// </summary> public void Merge(LWWRegister lWWRegister) { if (lWWRegister.TimeStamp > this.TimeStamp) { this.Value = lWWRegister.Value; } }
public void LWWRegisterTest() { LWWRegister replica1 = new LWWRegister(1); LWWRegister replica2 = new LWWRegister(2); replica1.SetValue(5); System.Threading.Thread.Sleep(1); replica2.SetValue(6); replica1.Merge(replica2); Assert.AreEqual(6, replica1.Query()); }