コード例 #1
0
 public void TestAddRemoveDispose()
 {
     var sourceList = new ObservableList<string>();
     var targetList = new Collection<string>();
     var syncer1 = new CollectionSyncer<string, string>(sourceList, targetList, (x) => x.ToUpper(), (x) => x.ToUpper(), false);
     var syncer2 = new CollectionSyncer<string, string>(sourceList, targetList, (x) => x.ToLower(), (x) => x.ToLower(), false);
     sourceList.Add("Test1");
     Assert.Equal(2, targetList.Count);
     Assert.True(targetList.Contains("test1"));
     Assert.True(targetList.Contains("TEST1"));
     sourceList.Remove("Test1");
     Assert.Equal(sourceList.Count, targetList.Count);
     Assert.Equal(0, targetList.Count);
     syncer2.Dispose();
     sourceList.Add("Test1");
     Assert.Equal(sourceList.Count, targetList.Count);
 }