/// <summary> /// Merge method /// </summary> public void Merge(GCounter gCounter2) { for (int i = 0; i < 10; i++) { this.State[i] = Math.Max(this.State[i], gCounter2.State[i]); } }
public void GCounterTest() { GCounter replica1 = new GCounter(1); GCounter replica2 = new GCounter(2); replica1.Increment(); replica2.Increment(); replica2.Increment(); replica1.Merge(replica2); replica1.Merge(replica2); Assert.AreEqual(3, replica1.Query()); }