public void FiltersByTwoProperties() { //Arrange const string name = "John"; DateTime created = new DateTime(2016, 2, 12); var descriptors = new List <FilterDescriptor> { new FilterDescriptor { PropertyName = "Name", Value = name }, new FilterDescriptor { PropertyName = "Created", Value = created.ToString() } }; var collection = Builder <FilterContext.DummyData> .CreateListOfSize(10) .Random(3) .With(x => x.Name = name) .With(x => x.Created = created) .Random(2) .With(x => x.Name = name) .Random(1) .With(x => x.Created = created) .Build(); //Act var result = _filter.ApplyFilters(collection, descriptors); //Assert result.All(x => x.Name == name && x.Created == created).Should().BeTrue(); result.Count.Should().Be(3); }
public void WhenCollectionIsNull() { //Arrange var filters = new List <FilterDescriptor> { new FilterDescriptor() }; //Act var result = _filter.ApplyFilters <FilterContext.DummyData>(null, filters); //Assert result.Should().BeNull(); }