public async Task ObservableGroupedSourceCollectionItemsSourceChangedReplace() { tlog.Debug(tag, $"ObservableItemSourceCollectionItemsSourceChanged START"); TaskCompletionSource <bool> tcs = new TaskCompletionSource <bool>(false); NotifyCollectionChangedEventHandler onChanged = (s, e) => { tcs.TrySetResult(true); }; var model = new TestModel(); var cView = new CollectionView(model); var testingTarget = new ObservableGroupedSource(cView, cView); model.CollectionChanged += onChanged; Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <ObservableGroupedSource>(testingTarget, "should be an instance of testing target class!"); model[0] = "test"; var result = await tcs.Task; Assert.IsTrue(result, "Change event should be invoked"); tlog.Debug(tag, "Count : " + testingTarget.Count); tlog.Debug(tag, $"ObservableItemSourceCollectionItemsSourceChanged END (OK)"); }
public void ObservableGroupedSourceConstructor() { tlog.Debug(tag, $"ObservableGroupedSourceConstructor START"); var model = new TestModel(); var cView = new CollectionView(model); var testingTarget = new ObservableGroupedSource(cView, cView); Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <ObservableGroupedSource>(testingTarget, "should be an instance of testing target class!"); testingTarget.Dispose(); tlog.Debug(tag, $"ObservableGroupedSourceConstructor END (OK)"); }
public void ObservableGroupedSourceGetPosition() { tlog.Debug(tag, $"ObservableGroupedSourceGetPosition START"); var model = new TestModel(); var cView = new CollectionView(model); var testingTarget = new ObservableGroupedSource(cView, cView); Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <ObservableGroupedSource>(testingTarget, "should be an instance of testing target class!"); Assert.AreEqual(testingTarget.GetPosition("Cat"), 0, "should be equal."); testingTarget.Dispose(); tlog.Debug(tag, $"ObservableGroupedSourceGetPosition END (OK)"); }
public void ObservableGroupedSourceIsHeader() { tlog.Debug(tag, $"ObservableGroupedSourceIsHeader START"); var model = new TestModel(); var cView = new CollectionView(model); var testingTarget = new ObservableGroupedSource(cView, cView); Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <ObservableGroupedSource>(testingTarget, "should be an instance of testing target class!"); testingTarget.HasHeader = true; Assert.IsTrue(testingTarget.IsHeader(0), "The item should be footer."); testingTarget.Dispose(); tlog.Debug(tag, $"ObservableGroupedSourceIsHeader END (OK)"); }