public void when_contacts_are_same_person_they_should_be_merged() { var fixture = new Fixture(); var contact1 = fixture.Create <Contact>(); var contact2 = fixture.Create <Contact>(); var leftList = new[] { contact2 }.ToList(); var rightList = new[] { contact1 }.ToList(); var signal = new ManualResetEvent(false); MergeOutput <Contact> actual = null; int outpuItems = 0; var target = new DefaultIdentityBatchMerge(new AlwaysSameIdentity(), new AlwaysMerge()) { ProcessedItem = x => { outpuItems++; actual = x; }, Finish = () => signal.Set() }; target.MergeAsync(leftList, rightList); signal.WaitOne(); Assert.IsNotNull(actual); Assert.IsTrue(actual.MergeOperation == MergeOperation.Merged); Assert.IsTrue(outpuItems == 1); }
static void OnProcessedItem(MergeOutput <Contact> mergeItem) { Helper.LogInfo("{0} => {1}", mergeItem.MergeOperation.ToString().PadRight(10), mergeItem.Result.Print()); Trace.WriteLine(mergeItem.Result.ToJson() + ","); }