public ConfigurationBuilder() { Welcome = new WelcomeConfigurationBuilder(this); Security = new SecurityConfigurationBuilder(this); Mapping = new MappingConfiguration(this); Query = new QueryConfigurationBuilder(this); Workflows = new WorkflowConfigurationBuilder(this); }
public void ApplyConfig() { var items = new List <Contact> { new Contact { FirstName = "John", LastName = "Doe" }, new Contact { FirstName = "Max", LastName = "Mustermann" }, new Contact { FirstName = "Jane", LastName = "Doe" } }; var query = items.AsQueryable(); var builder = new StringFilterItemBuilder(); builder.Left = new PathValueExpressionBuilder { Path = "LastName" }; builder.Right = new StringConstantValueBuilder { Value = "Doe" }; builder.Operator = Lucile.Linq.Configuration.StringOperator.Equal; var configBuilder = new QueryConfigurationBuilder(); configBuilder.FilterItems.Add(builder); configBuilder.SortItems.Add(new SortItemBuilder() { PropertyPath = "FirstName", SortDirection = SortDirection.Ascending }); var result = query.Apply(configBuilder.Build()); Assert.Equal(2, result.Count()); Assert.All(result, p => Assert.Equal("Doe", p.LastName)); Assert.Equal(items[2], result.ToList()[0]); Assert.Equal(items[0], result.ToList()[1]); }