public void WhenGettingAssembliesThenReturnsAssemblies() { // Assign IAssembliesResolver resolver = new DefaultAssembliesResolver(); // Act ICollection<Assembly> assemblies = resolver.GetAssemblies(); // Assert Assert.NotNull(assemblies); }
public void WhenGettingAssembliesThenReturnsAssemblies() { // Assign IAssembliesResolver resolver = new DefaultAssembliesResolver(); // Act ICollection <Assembly> assemblies = resolver.GetAssemblies(); // Assert Assert.NotNull(assemblies); }
protected static void GetApplyToParams(out ODataQuerySettings settings, out EdmModel model, out ODataQueryContext context, out IAssembliesResolver assembliesResolver) { settings = new ODataQuerySettings() { PageSize = 2000, HandleNullPropagation = HandleNullPropagationOption.False }; assembliesResolver = new DefaultAssembliesResolver(); model = TestModelBuilder.CreateModel(new Type[] { typeof(Category), typeof(Product), typeof(Sales) }); context = new ODataQueryContext(model, typeof(Sales), new ODataPath(new ODataPathSegment[] { new EntitySetPathSegment("Sales") })); }
private static void GetGroupByParams(string value, out IQueryable data, out ODataQueryContext context, out ODataQuerySettings settings, out ApplyGroupbyClause groupByClause, out DefaultAssembliesResolver assembliesResolver, out GroupByImplementation groupByImplementation, out Type keyType, out IEnumerable <LambdaExpression> propertiesToGroupByExpressions) { string queryOption = "$apply"; data = TestDataSource.CreateData(); settings = new ODataQuerySettings() { PageSize = 2000, HandleNullPropagation = HandleNullPropagationOption.False }; var _settings = settings; var model = TestModelBuilder.CreateModel(new Type[] { typeof(Category), typeof(Product), typeof(Sales) }); context = new ODataQueryContext(model, typeof(Sales), new ODataPath(new ODataPathSegment[] { new EntitySetPathSegment("Sales") })); var _context = context; IEdmNavigationSource source = model.FindDeclaredEntitySet("Sales"); var parser = new ODataQueryOptionParser(model, model.FindDeclaredType("System.Web.OData.Aggregation.Tests.Common.Sales"), source, new Dictionary <string, string>() { { queryOption, value } }); var applyCaluse = parser.ParseApply(); groupByClause = applyCaluse.Transformations.First().Item2 as ApplyGroupbyClause; assembliesResolver = new DefaultAssembliesResolver(); var _assembliesResolver = assembliesResolver; groupByImplementation = new GroupByImplementation() { Context = context }; keyType = groupByImplementation.GetGroupByKeyType(groupByClause); var entityParam = Expression.Parameter(context.ElementClrType, "$it"); propertiesToGroupByExpressions = groupByClause.SelectedPropertiesExpressions.Select( exp => FilterBinder.Bind(exp, _context.ElementClrType, _context.Model, _assembliesResolver, _settings, entityParam)); }
// NOTE: This method has been stolen from InitializeCache() private method in // System.Web.Http.Dispatcher.HttpControllerTypeCache class of the // ASP.NET Web API source code, with a little change. private Dictionary <string, ILookup <string, Type> > GetControllerTypeGroups() { IAssembliesResolver assembliesResolver = new DefaultAssembliesResolver(); // NOTE: the above line was originally: // _configuration.Services.GetAssembliesResolver(); IHttpControllerTypeResolver controllersResolver = new DefaultHttpControllerTypeResolver(); // NOTE: the above line was originally: // _configuration.Services.GetHttpControllerTypeResolver(); ICollection <Type> controllerTypes = controllersResolver.GetControllerTypes(assembliesResolver); var groupedByName = controllerTypes.GroupBy( t => t.Name.Substring(0, t.Name.Length - DefaultHttpControllerSelector.ControllerSuffix.Length), StringComparer.OrdinalIgnoreCase); return(groupedByName.ToDictionary( g => g.Key, g => g.ToLookup(t => t.Namespace ?? String.Empty, StringComparer.OrdinalIgnoreCase), StringComparer.OrdinalIgnoreCase)); }