public void SortDescriptionsAddWithEnumerable() { var items = new TestEnumerable(new TestModel[0]); var cvs = new Rotorsoft.Forms.CollectionViewSource(); cvs.Source = items; cvs.SortDescriptions = new ObservableCollection <SortDescription>(); Assert.Throws <InvalidOperationException>(() => cvs.SortDescriptions.Add(new SortDescription(nameof(TestModel.Name), ListSortDirection.Ascending))); }
public void SourceWithNonEmptyEnumerable() { var items = new TestEnumerable(new object[] { "Lorem Ipsum" }); var cvs = new Rotorsoft.Forms.CollectionViewSource(); cvs.Source = items; Assert.Same(items, cvs.Source); Assert.NotNull(cvs.View); Assert.NotEmpty(cvs.View); }
public void FilterWithEnumerable() { var items = new TestEnumerable(new object[] { 10, "Lorem Ipsum", TimeSpan.Zero, }); Predicate <object> filterPredicate = (item) => item is string; var cvs = new Rotorsoft.Forms.CollectionViewSource(); cvs.Source = items; cvs.Filter = filterPredicate; Assert.Same(filterPredicate, cvs.Filter); Assert.NotNull(cvs.View); Assert.NotEmpty(cvs.View); Assert.Equal(1, cvs.View.Count()); }