public void correct_iquerable_should_be_returned() { var source = new[] { new DummyDocument { Name = "First", }, new DummyDocument { Name = "Middle", }, new DummyDocument { Name = "Last", } } .AsQueryable(); var sortedData = source.DynamicFiltering( propertyName: "name", value: "NON_EXISTENT_NAME"); sortedData.Any().Should().BeFalse(); }
public void correct_iquerable_should_be_returned() { var source = new[] { new DummyDocument { Name = "First", }, new DummyDocument { Name = "Middle", }, new DummyDocument { Name = "Last", } } .AsQueryable(); var sortedData = source.DynamicFiltering("name", "Last"); var expectedSortedData = source.Where(document => document.Name == "Last"); sortedData.SequenceEqual(expectedSortedData).Should().BeTrue(); }
public void should_throw_property_doesnt_exist_exception() { var source = new[] { new DummyDocument { Id = 1, Name = "First", Count = 2 } } .AsQueryable(); source.DynamicFiltering("not_existing_property", "3"); }