From 65bd8c448af3c70ee8e85c97bf4feddfd418274b Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Thu, 16 Apr 2015 08:27:17 -0700 Subject: [PATCH] Removed Logging related ILogValues types and cleaned up tests. --- .../DefaultControllerModelBuilder.cs | 6 +- .../ControllerActionDescriptorProvider.cs | 14 +- ...aultActionDescriptorsCollectionProvider.cs | 14 +- .../Logging/ActionConstraintValues.cs | 51 ------ .../Logging/ActionDescriptorValues.cs | 121 ------------- .../Logging/ActionModelValues.cs | 95 ----------- .../Logging/ApiExplorerModelValues.cs | 33 ---- .../Logging/AttributeRouteInfoValues.cs | 37 ---- .../Logging/AttributeRouteModelValues.cs | 46 ----- .../Logging/ControllerModelValues.cs | 98 ----------- .../Logging/FilterDescriptorValues.cs | 38 ----- .../Logging/FilterValues.cs | 64 ------- .../Logging/ParameterDescriptorValues.cs | 32 ---- .../Logging/ParameterModelValues.cs | 34 ---- .../Logging/PropertyModelValues.cs | 34 ---- .../Logging/RouteConstraintProviderValues.cs | 43 ----- .../RouteDataActionConstraintValues.cs | 37 ---- .../ActionConstraintValuesTest.cs | 85 --------- .../ActionModelValuesTest.cs | 24 --- .../ApiExplorerModelValuesTest.cs | 20 --- .../DefaultControllerModelBuilderTest.cs | 28 +-- .../AttributeRouteInfoValuesTest.cs | 24 --- .../AttributeRouteModelValuesTest.cs | 20 --- ...ControllerActionDescriptorProviderTests.cs | 28 +-- .../ControllerModelValuesTest.cs | 24 --- ...DescriptorCollectionProviderLoggingTest.cs | 161 ------------------ .../DefaultActionSelectorTests.cs | 10 +- .../FilterDescriptorValuesTest.cs | 20 --- .../FilterValuesTest.cs | 99 ----------- .../KnownRouteValueConstraintTests.cs | 2 +- .../RouteConstraintProviderValuesTest.cs | 23 --- .../RouteDataActionConstraintValuesTest.cs | 19 --- .../Logging/LoggingStartupTest.cs | 113 ------------ .../Metadata/DefaultModelMetadataTest.cs | 1 - .../ApiControllerActionDiscoveryTest.cs | 8 +- 35 files changed, 24 insertions(+), 1482 deletions(-) delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/ActionConstraintValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/ActionDescriptorValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/ActionModelValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/ApiExplorerModelValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/AttributeRouteInfoValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/AttributeRouteModelValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/ControllerModelValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/FilterDescriptorValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/FilterValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/ParameterDescriptorValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/ParameterModelValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/PropertyModelValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/RouteConstraintProviderValues.cs delete mode 100644 src/Microsoft.AspNet.Mvc.Core/Logging/RouteDataActionConstraintValues.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/ActionConstraintValuesTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/ActionModelValuesTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/ApiExplorerModelValuesTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/AttributeRouteInfoValuesTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/AttributeRouteModelValuesTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/ControllerModelValuesTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionDescriptorCollectionProviderLoggingTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/FilterDescriptorValuesTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/FilterValuesTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/RouteConstraintProviderValuesTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.Core.Test/RouteDataActionConstraintValuesTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingStartupTest.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/DefaultControllerModelBuilder.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/DefaultControllerModelBuilder.cs index fff2f915f9..54272e789d 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/DefaultControllerModelBuilder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/DefaultControllerModelBuilder.cs @@ -12,7 +12,6 @@ using Microsoft.AspNet.Mvc.Filters; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Routing; using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; namespace Microsoft.AspNet.Mvc.ApplicationModels @@ -23,7 +22,6 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels public class DefaultControllerModelBuilder : IControllerModelBuilder { private readonly IActionModelBuilder _actionModelBuilder; - private readonly ILogger _logger; private readonly AuthorizationOptions _authorizationOptions; /// @@ -31,12 +29,10 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels /// /// The used to create actions. public DefaultControllerModelBuilder( - IActionModelBuilder actionModelBuilder, - ILoggerFactory loggerFactory, + IActionModelBuilder actionModelBuilder, IOptions authorizationOptions) { _actionModelBuilder = actionModelBuilder; - _logger = loggerFactory.CreateLogger(); _authorizationOptions = authorizationOptions?.Options ?? new AuthorizationOptions(); } diff --git a/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs index 5a99430f4f..5a09e056ea 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs @@ -4,9 +4,7 @@ using System.Collections.Generic; using Microsoft.AspNet.Mvc.ApplicationModels; using Microsoft.AspNet.Mvc.Filters; -using Microsoft.AspNet.Mvc.Logging; using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; namespace Microsoft.AspNet.Mvc.Core @@ -17,19 +15,16 @@ namespace Microsoft.AspNet.Mvc.Core private readonly IControllerTypeProvider _controllerTypeProvider; private readonly IReadOnlyList _globalFilters; private readonly IEnumerable _conventions; - private readonly ILogger _logger; public ControllerActionDescriptorProvider([NotNull] IControllerTypeProvider controllerTypeProvider, [NotNull] IControllerModelBuilder applicationModelBuilder, [NotNull] IGlobalFilterProvider globalFilters, - [NotNull] IOptions optionsAccessor, - [NotNull] ILoggerFactory loggerFactory) + [NotNull] IOptions optionsAccessor) { _controllerTypeProvider = controllerTypeProvider; _applicationModelBuilder = applicationModelBuilder; _globalFilters = globalFilters.Filters; _conventions = optionsAccessor.Options.Conventions; - _logger = loggerFactory.CreateLogger(); } public int Order @@ -55,13 +50,6 @@ namespace Microsoft.AspNet.Mvc.Core { var applicationModel = BuildModel(); ApplicationModelConventions.ApplyConventions(applicationModel, _conventions); - if (_logger.IsEnabled(LogLevel.Verbose)) - { - foreach (var controller in applicationModel.Controllers) - { - _logger.LogVerbose(new ControllerModelValues(controller)); - } - } return ControllerActionDescriptorBuilder.Build(applicationModel); } diff --git a/src/Microsoft.AspNet.Mvc.Core/DefaultActionDescriptorsCollectionProvider.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultActionDescriptorsCollectionProvider.cs index 9af8aa4a4e..0252b61df6 100644 --- a/src/Microsoft.AspNet.Mvc.Core/DefaultActionDescriptorsCollectionProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/DefaultActionDescriptorsCollectionProvider.cs @@ -4,9 +4,7 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using Microsoft.AspNet.Mvc.Logging; using Microsoft.Framework.DependencyInjection; -using Microsoft.Framework.Logging; namespace Microsoft.AspNet.Mvc.Core { @@ -17,17 +15,15 @@ namespace Microsoft.AspNet.Mvc.Core public class DefaultActionDescriptorsCollectionProvider : IActionDescriptorsCollectionProvider { private readonly IServiceProvider _serviceProvider; - private readonly ILogger _logger; private ActionDescriptorsCollection _collection; /// /// Initializes a new instance of the class. /// /// The application IServiceProvider. - public DefaultActionDescriptorsCollectionProvider(IServiceProvider serviceProvider, ILoggerFactory factory) + public DefaultActionDescriptorsCollectionProvider(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; - _logger = factory.CreateLogger(); } /// @@ -65,14 +61,6 @@ namespace Microsoft.AspNet.Mvc.Core providers[i].OnProvidersExecuted(context); } - if (_logger.IsEnabled(LogLevel.Verbose)) - { - foreach (var actionDescriptor in context.Results) - { - _logger.LogVerbose(new ActionDescriptorValues(actionDescriptor)); - } - } - return new ActionDescriptorsCollection( new ReadOnlyCollection(context.Results), 0); } diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/ActionConstraintValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/ActionConstraintValues.cs deleted file mode 100644 index 1ad5791587..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/ActionConstraintValues.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNet.Mvc.ActionConstraints; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of an . - /// - public class ActionConstraintValues : ReflectionBasedLogValues - { - public ActionConstraintValues(IActionConstraintMetadata inner) - { - var constraint = inner as IActionConstraint; - if (constraint != null) - { - IsConstraint = true; - Order = constraint.Order; - } - if (inner is IActionConstraintFactory) - { - IsFactory = true; - } - ActionConstraintMetadataType = inner.GetType(); - } - - /// - /// The of this . - /// - public Type ActionConstraintMetadataType { get; } - - /// - /// The constraint order if this is an . See - /// . - /// - public int Order { get; } - - /// - /// Whether the action constraint is an . - /// - public bool IsConstraint { get; } - - /// - /// Whether the action constraint is an . - /// - public bool IsFactory { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/ActionDescriptorValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/ActionDescriptorValues.cs deleted file mode 100644 index bd0c719dda..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/ActionDescriptorValues.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of the state of an or - /// . Logged during action discovery. - /// - public class ActionDescriptorValues : ReflectionBasedLogValues - { - public ActionDescriptorValues([NotNull] ActionDescriptor inner) - { - Name = inner.Name; - DisplayName = inner.DisplayName; - Parameters = inner.Parameters.Select(p => new ParameterDescriptorValues(p)).ToList(); - BoundProperties = inner.BoundProperties.Select(p => new ParameterDescriptorValues(p)).ToList(); - FilterDescriptors = inner.FilterDescriptors.Select(f => new FilterDescriptorValues(f)).ToList(); - RouteConstraints = inner.RouteConstraints.Select(r => new RouteDataActionConstraintValues(r)).ToList(); - AttributeRouteInfo = new AttributeRouteInfoValues(inner.AttributeRouteInfo); - RouteValueDefaults = inner.RouteValueDefaults.ToDictionary(i => i.Key, i => i.Value.ToString()); - ActionConstraints = inner.ActionConstraints?.Select(a => new ActionConstraintValues(a))?.ToList(); - HttpMethods = - inner.ActionConstraints?.OfType().SelectMany(c => c.HttpMethods).ToList(); - Properties = inner.Properties.ToDictionary(i => i.Key.ToString(), i => i.Value.GetType()); - var controllerActionDescriptor = inner as ControllerActionDescriptor; - if (controllerActionDescriptor != null) - { - MethodInfo = controllerActionDescriptor.MethodInfo; - ControllerName = controllerActionDescriptor.ControllerName; - ControllerTypeInfo = controllerActionDescriptor.ControllerTypeInfo; - } - } - - /// - /// The name of the action. See . - /// - public string Name { get; } - - /// - /// A friendly name for the action. See . - /// - public string DisplayName { get; } - - /// - /// The parameters of the action as . - /// See . - /// - public IList Parameters { get; } - - /// - /// The parameters of the action as . - /// See . - /// - public IList BoundProperties { get; } - - /// - /// The filters of the action as . - /// See . - /// - public IList FilterDescriptors { get; } - - /// - /// The route constraints of the action as . - /// See - /// - public IList RouteConstraints { get; } - - /// - /// The attribute route info of the action as . - /// See . - /// - public AttributeRouteInfoValues AttributeRouteInfo { get; } - - /// - /// See . - /// - public IDictionary RouteValueDefaults { get; } - - /// - /// The action constraints of the action as . - /// See . - /// - public IList ActionConstraints { get; } - - /// - /// The http methods this action supports. - /// - public IList HttpMethods { get; } - - /// - /// See . - /// - public IDictionary Properties { get; } - - /// - /// The method info of the action if this is a . - /// See . - /// - public MethodInfo MethodInfo { get; } - - /// - /// The name of the action's controller if this is a . - /// See . - /// - public string ControllerName { get; } - - /// - /// The type info of the action's controller if this is a . - /// See . - /// - public TypeInfo ControllerTypeInfo { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/ActionModelValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/ActionModelValues.cs deleted file mode 100644 index 47d841d333..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/ActionModelValues.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Microsoft.AspNet.Mvc.ApplicationModels; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Represents the state of an . - /// Logged as a substructure of - /// - public class ActionModelValues : ReflectionBasedLogValues - { - // note: omit the controller as this structure is nested inside the ControllerModelValues it belongs to - public ActionModelValues(ActionModel inner) - { - if (inner != null) - { - ActionName = inner.ActionName; - ActionMethod = inner.ActionMethod; - ApiExplorer = new ApiExplorerModelValues(inner.ApiExplorer); - Parameters = inner.Parameters.Select(p => new ParameterModelValues(p)).ToList(); - RouteConstraints = inner.RouteConstraints.Select( - r => new RouteConstraintProviderValues(r)).ToList(); - Filters = inner.Filters.Select(f => new FilterValues(f)).ToList(); - if (inner.AttributeRouteModel != null) - { - AttributeRouteModel = new AttributeRouteModelValues(inner.AttributeRouteModel); - } - HttpMethods = inner.HttpMethods; - ActionConstraints = inner.ActionConstraints?.Select(a => new ActionConstraintValues(a))?.ToList(); - Properties = new Dictionary(inner.Properties); - } - } - - /// - /// The name of the action. See . - /// - public string ActionName { get; } - - /// - /// The method info of the action. See . - /// - public MethodInfo ActionMethod { get; } - - /// - /// See . - /// - public ApiExplorerModelValues ApiExplorer { get; } - - /// - /// The parameters of the action as . - /// See . - /// - public IList Parameters { get; } - - /// - /// The filters of the action as . - /// See . - /// - public IList Filters { get; } - - /// - /// The route constraints on the controller as . - /// See . - /// - public IList RouteConstraints { get; set; } - - /// - /// The attribute route model of the action as . - /// See . - /// - public AttributeRouteModelValues AttributeRouteModel { get; } - - /// - /// The http methods this action supports. See . - /// - public IList HttpMethods { get; } - - /// - /// The action constraints of the action as . - /// See . - /// - public IList ActionConstraints { get; } - - /// - /// Gets the set of properties associated with the action . - /// - public IDictionary Properties { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/ApiExplorerModelValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/ApiExplorerModelValues.cs deleted file mode 100644 index 0b717928ea..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/ApiExplorerModelValues.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.ApplicationModels; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of an . - /// - public class ApiExplorerModelValues : ReflectionBasedLogValues - { - public ApiExplorerModelValues(ApiExplorerModel inner) - { - if (inner != null) - { - IsVisible = inner.IsVisible; - GroupName = inner.GroupName; - } - } - - /// - /// See . - /// - public bool? IsVisible { get; } - - /// - /// See . - /// - public string GroupName { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/AttributeRouteInfoValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/AttributeRouteInfoValues.cs deleted file mode 100644 index 4e8ea31cb6..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/AttributeRouteInfoValues.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.Routing; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of the state of a . Logged as a substructure of - /// . - /// - public class AttributeRouteInfoValues : ReflectionBasedLogValues - { - public AttributeRouteInfoValues(AttributeRouteInfo inner) - { - Template = inner?.Template; - Order = inner?.Order; - Name = inner?.Name; - } - - /// - /// The route template. See . - /// - public string Template { get; } - - /// - /// The order of the route. See . - /// - public int? Order { get; } - - /// - /// The name of the route. See . - /// - public string Name { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/AttributeRouteModelValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/AttributeRouteModelValues.cs deleted file mode 100644 index c8f3612c3b..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/AttributeRouteModelValues.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.ApplicationModels; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of the state of a . Logged as a substructure of - /// . - /// - public class AttributeRouteModelValues : ReflectionBasedLogValues - { - public AttributeRouteModelValues(AttributeRouteModel inner) - { - if (inner != null) - { - Template = inner.Template; - Order = inner.Order; - Name = inner.Name; - IsAbsoluteTemplate = inner.IsAbsoluteTemplate; - } - } - - /// - /// The template of the route. See . - /// - public string Template { get; } - - /// - /// The order of the route. See . - /// - public int? Order { get; } - - /// - /// The name of the route. See . - /// - public string Name { get; } - - /// - /// Whether or not the template is absolute. See . - /// - public bool IsAbsoluteTemplate { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/ControllerModelValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/ControllerModelValues.cs deleted file mode 100644 index 46497cc486..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/ControllerModelValues.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNet.Mvc.ApplicationModels; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of the state of a . Logged during controller discovery. - /// - public class ControllerModelValues : ReflectionBasedLogValues - { - public ControllerModelValues(ControllerModel inner) - { - if (inner != null) - { - ControllerName = inner.ControllerName; - ControllerType = inner.ControllerType.AsType(); - ApiExplorer = new ApiExplorerModelValues(inner.ApiExplorer); - Actions = inner.Actions.Select(a => new ActionModelValues(a)).ToList(); - Attributes = inner.Attributes.Select(a => a.GetType()).ToList(); - ControllerProperties = inner.ControllerProperties.Select(p => new PropertyModelValues(p)).ToList(); - Filters = inner.Filters.Select(f => new FilterValues(f)).ToList(); - ActionConstraints = inner.ActionConstraints?.Select(a => new ActionConstraintValues(a))?.ToList(); - RouteConstraints = inner.RouteConstraints.Select( - r => new RouteConstraintProviderValues(r)).ToList(); - AttributeRoutes = inner.AttributeRoutes.Select( - a => new AttributeRouteModelValues(a)).ToList(); - Properties = new Dictionary(inner.Properties); - } - } - - /// - /// The name of the controller. See . - /// - public string ControllerName { get; } - - /// - /// The of the controller. See . - /// - public Type ControllerType { get; } - - /// - /// The of the controller. See . - /// - public IList ControllerProperties { get; } - - /// - /// See . - /// - public ApiExplorerModelValues ApiExplorer { get; } - - /// - /// The actions of the controller as . - /// See . - /// - public IList Actions { get; } - - /// - /// The s of the controller's attributes. - /// See . - /// - public IList Attributes { get; } - - /// - /// The filters on the controller as . - /// See . - /// - public IList Filters { get; } - - /// - /// The action constraints on the controller as . - /// See . - /// - public IList ActionConstraints { get; } - - /// - /// The route constraints on the controller as . - /// See . - /// - public IList RouteConstraints { get; set; } - - /// - /// The attribute routes on the controller as . - /// See . - /// - public IList AttributeRoutes { get; set; } - - /// - /// Gets the set of properties associated with the controller . - /// - public IDictionary Properties { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/FilterDescriptorValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/FilterDescriptorValues.cs deleted file mode 100644 index e23702ad75..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/FilterDescriptorValues.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of the state of a . Logged as a substructure of - /// . - /// - public class FilterDescriptorValues : ReflectionBasedLogValues - { - public FilterDescriptorValues([NotNull] FilterDescriptor inner) - { - Filter = new FilterValues(inner.Filter); - Order = inner.Order; - Scope = inner.Scope; - } - - /// - /// The instance of the filter descriptor as . - /// See . - /// - public FilterValues Filter { get; } - - /// - /// The filter order. See . - /// - public int Order { get; } - - /// - /// The filter scope. See . - /// - public int Scope { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/FilterValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/FilterValues.cs deleted file mode 100644 index 8bc77e2379..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/FilterValues.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of an . Logged as a component of - /// , and as a substructure of - /// and . - /// - public class FilterValues : ReflectionBasedLogValues - { - public FilterValues(IFilter inner) - { - FilterMetadataType = inner.GetType(); - if (inner is IFilterFactory) - { - IsFactory = true; - if (inner is ServiceFilterAttribute) - { - FilterType = ((ServiceFilterAttribute)inner).ServiceType; - } - else if (inner is TypeFilterAttribute) - { - FilterType = ((TypeFilterAttribute)inner).ImplementationType; - } - } - if (FilterType != null) - { - FilterInterfaces = FilterType.GetInterfaces().ToList(); - } - else - { - FilterInterfaces = FilterMetadataType.GetInterfaces().ToList(); - } - } - - /// - /// Whether or not the instance of is an . - /// - public bool IsFactory { get; } - - /// - /// The metadata type of the . - /// - public Type FilterMetadataType { get; } - - /// - /// The inner of the if it is a - /// or . - /// - public Type FilterType { get; } - - /// - /// A list of interfaces the implements. - /// - public IList FilterInterfaces { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/ParameterDescriptorValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/ParameterDescriptorValues.cs deleted file mode 100644 index f1893574c6..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/ParameterDescriptorValues.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of a . Logged as a substructure of - /// . - /// - public class ParameterDescriptorValues : ReflectionBasedLogValues - { - public ParameterDescriptorValues([NotNull] ParameterDescriptor inner) - { - ParameterName = inner.Name; - ParameterType = inner.ParameterType; - } - - /// - /// The name of the parameter. See . - /// - public string ParameterName { get; } - - /// - /// The of the parameter. See . - /// - public Type ParameterType { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/ParameterModelValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/ParameterModelValues.cs deleted file mode 100644 index 4a8fecc1c3..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/ParameterModelValues.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNet.Mvc.ApplicationModels; -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of a . Logged as a substructure of - /// , this contains the name, type, and - /// binder metadata of the parameter. - /// - public class ParameterModelValues : ReflectionBasedLogValues - { - public ParameterModelValues([NotNull] ParameterModel inner) - { - ParameterName = inner.ParameterName; - ParameterType = inner.ParameterInfo.ParameterType; - } - - /// - /// The name of the parameter. See . - /// - public string ParameterName { get; } - - /// - /// The of the parameter. - /// - public Type ParameterType { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/PropertyModelValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/PropertyModelValues.cs deleted file mode 100644 index 8bf1a1dbe3..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/PropertyModelValues.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNet.Mvc.ApplicationModels; -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of a . Logged as a substructure of - /// , this contains the name, type, and - /// binder metadata of the property. - /// - public class PropertyModelValues : ReflectionBasedLogValues - { - public PropertyModelValues([NotNull] PropertyModel inner) - { - PropertyName = inner.PropertyName; - PropertyType = inner.PropertyInfo.PropertyType; - } - - /// - /// The name of the property. See . - /// - public string PropertyName { get; } - - /// - /// The of the property. - /// - public Type PropertyType { get; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/RouteConstraintProviderValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/RouteConstraintProviderValues.cs deleted file mode 100644 index a3035f03fd..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/RouteConstraintProviderValues.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of a . Logged as a substructure of - /// - /// - public class RouteConstraintProviderValues : ReflectionBasedLogValues - { - public RouteConstraintProviderValues([NotNull] IRouteConstraintProvider inner) - { - RouteKey = inner.RouteKey; - RouteValue = inner.RouteValue; - RouteKeyHandling = inner.RouteKeyHandling; - BlockNonAttributedActions = inner.BlockNonAttributedActions; - } - - /// - /// The route value key. See . - /// - public string RouteKey { get; } - - /// - /// The expected route value. See . - /// - public string RouteValue { get; } - - /// - /// The . See . - /// - public RouteKeyHandling RouteKeyHandling { get; } - - /// - /// See . - /// - public bool BlockNonAttributedActions { get; } - } -} diff --git a/src/Microsoft.AspNet.Mvc.Core/Logging/RouteDataActionConstraintValues.cs b/src/Microsoft.AspNet.Mvc.Core/Logging/RouteDataActionConstraintValues.cs deleted file mode 100644 index 9534ff41ab..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/Logging/RouteDataActionConstraintValues.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Mvc.Logging -{ - /// - /// Logging representation of the state of a . Logged as a substructure of - /// . - /// - public class RouteDataActionConstraintValues : ReflectionBasedLogValues - { - public RouteDataActionConstraintValues([NotNull] RouteDataActionConstraint inner) - { - RouteKey = inner.RouteKey; - RouteValue = inner.RouteValue; - KeyHandling = inner.KeyHandling; - } - - /// - /// The route key. See . - /// - public string RouteKey { get; } - - /// - /// The route value. See . - /// - public string RouteValue { get; } - - /// - /// The . See . - /// - public RouteKeyHandling KeyHandling { get; } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionConstraintValuesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ActionConstraintValuesTest.cs deleted file mode 100644 index 6f290cc53e..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ActionConstraintValuesTest.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNet.Mvc.ActionConstraints; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Logging -{ - public class ActionConstraintValuesTest - { - [Fact] - public void IActionConstraintMetadata_InitializesCorrectValues() - { - // Arrange - var constraint = new TestConstraintMetadata(); - - // Act - var constraintValues = new ActionConstraintValues(constraint); - - // Assert - Assert.False(constraintValues.IsConstraint); - Assert.False(constraintValues.IsFactory); - Assert.Equal(0, constraintValues.Order); - Assert.Equal(typeof(TestConstraintMetadata), constraintValues.ActionConstraintMetadataType); - } - - [Fact] - public void IActionConstraint_InitializesCorrectValues() - { - // Arrange - var constraint = new TestConstraint(); - - // Act - var constraintValues = new ActionConstraintValues(constraint); - - // Assert - Assert.True(constraintValues.IsConstraint); - Assert.False(constraintValues.IsFactory); - Assert.Equal(23, constraintValues.Order); - Assert.Equal(typeof(TestConstraint), constraintValues.ActionConstraintMetadataType); - } - - [Fact] - public void IActionConstraintFactory_InitializesCorrectValues() - { - // Arrange - var constraint = new TestFactory(); - - // Act - var constraintValues = new ActionConstraintValues(constraint); - - // Assert - Assert.False(constraintValues.IsConstraint); - Assert.True(constraintValues.IsFactory); - Assert.Equal(0, constraintValues.Order); - Assert.Equal(typeof(TestFactory), constraintValues.ActionConstraintMetadataType); - } - - private class TestConstraintMetadata : IActionConstraintMetadata - { - } - - private class TestConstraint : IActionConstraint - { - public int Order - { - get { return 23; } - } - - public bool Accept(ActionConstraintContext context) - { - return false; - } - } - - private class TestFactory : IActionConstraintFactory - { - public IActionConstraint CreateInstance(IServiceProvider services) - { - return new TestConstraint(); - } - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionModelValuesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ActionModelValuesTest.cs deleted file mode 100644 index ec058efb7d..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ActionModelValuesTest.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.ApplicationModels; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Logging -{ - public class ActionModelValuesTest - { - [Fact] - public void ActionModelValues_IncludesAllProperties() - { - // Arrange - var exclude = new[] { "Controller", "Attributes", "IsActionNameMatchRequired" }; - - // Assert - PropertiesAssert.PropertiesAreTheSame( - typeof(ActionModel), - typeof(ActionModelValues), - exclude); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ApiExplorerModelValuesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ApiExplorerModelValuesTest.cs deleted file mode 100644 index 8ff5eb427a..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ApiExplorerModelValuesTest.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.ApplicationModels; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Logging -{ - public class ApiExplorerModelValuesTest - { - [Fact] - public void ApiExplorerModelValues_IncludesAllProperties() - { - // Assert - PropertiesAssert.PropertiesAreTheSame( - typeof(ApiExplorerModel), - typeof(ApiExplorerModelValues)); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/DefaultControllerModelBuilderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/DefaultControllerModelBuilderTest.cs index a852f9fca9..82dc2796ba 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/DefaultControllerModelBuilderTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/DefaultControllerModelBuilderTest.cs @@ -22,9 +22,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels public void BuildControllerModel_DerivedFromControllerClass_HasFilter() { // Arrange - var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var typeInfo = typeof(StoreController).GetTypeInfo(); // Act @@ -39,9 +37,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels public void BuildControllerModel_AuthorizeAttributeAddsAuthorizeFilter() { // Arrange - var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var typeInfo = typeof(AccountController).GetTypeInfo(); // Act @@ -61,8 +57,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels mockOptions.SetupGet(o => o.Options) .Returns(corsOptions); var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - authorizationOptions: null); + authorizationOptions: null); var typeInfo = typeof(CorsController).GetTypeInfo(); // Act @@ -76,9 +71,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels public void BuildControllerModel_AddsControllerProperties() { // Arrange - var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var typeInfo = typeof(ModelBinderController).GetTypeInfo(); // Act @@ -103,7 +96,6 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels mockOptions.SetupGet(o => o.Options) .Returns(corsOptions); var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, authorizationOptions: null); var typeInfo = typeof(DisableCorsController).GetTypeInfo(); @@ -120,9 +112,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels public void BuildControllerModel_ClassWithoutFilterInterfaces_HasNoControllerFilter() { // Arrange - var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var typeInfo = typeof(NoFiltersController).GetTypeInfo(); // Act @@ -137,9 +127,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels public void BuildControllerModel_ClassWithFilterInterfaces_HasFilter() { // Arrange - var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var typeInfo = typeof(SomeFiltersController).GetTypeInfo(); // Act @@ -154,9 +142,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels public void BuildControllerModel_ClassWithFilterInterfaces_UnsupportedType() { // Arrange - var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var builder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var typeInfo = typeof(UnsupportedFiltersController).GetTypeInfo(); // Act diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AttributeRouteInfoValuesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/AttributeRouteInfoValuesTest.cs deleted file mode 100644 index f9da445d10..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/AttributeRouteInfoValuesTest.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.ApplicationModels; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Logging -{ - public class AttributeRouteInfoValuesTest - { - [Fact] - public void AttributeRouteModelValues_IncludesAllProperties() - { - // Arrange - var exclude = new[] { "Attribute" }; - - // Assert - PropertiesAssert.PropertiesAreTheSame( - typeof(AttributeRouteModel), - typeof(AttributeRouteModelValues), - exclude); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AttributeRouteModelValuesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/AttributeRouteModelValuesTest.cs deleted file mode 100644 index 07b45ef980..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/AttributeRouteModelValuesTest.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.Routing; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Logging -{ - public class AttributeRouteModelValuesTest - { - [Fact] - public void AttributeRouteInfoValues_IncludesAllProperties() - { - // Assert - PropertiesAssert.PropertiesAreTheSame( - typeof(AttributeRouteInfo), - typeof(AttributeRouteInfoValues)); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs index 51b0d3a2ae..82086fbae0 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs @@ -1365,16 +1365,13 @@ namespace Microsoft.AspNet.Mvc.Test IEnumerable filters = null) { var controllerTypeProvider = new FixedSetControllerTypeProvider(new[] { controllerTypeInfo }); - var controllerModelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var controllerModelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var provider = new ControllerActionDescriptorProvider( controllerTypeProvider, controllerModelBuilder, new TestGlobalFilterProvider(filters), - new MockMvcOptionsAccessor(), - new NullLoggerFactory()); + new MockMvcOptionsAccessor()); return provider; } @@ -1383,16 +1380,13 @@ namespace Microsoft.AspNet.Mvc.Test params TypeInfo[] controllerTypeInfo) { var controllerTypeProvider = new FixedSetControllerTypeProvider(controllerTypeInfo); - var controllerModelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var controllerModelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var provider = new ControllerActionDescriptorProvider( controllerTypeProvider, controllerModelBuilder, new TestGlobalFilterProvider(), - new MockMvcOptionsAccessor(), - new NullLoggerFactory()); + new MockMvcOptionsAccessor()); return provider; } @@ -1402,9 +1396,7 @@ namespace Microsoft.AspNet.Mvc.Test IApplicationModelConvention convention) { var controllerTypeProvider = new FixedSetControllerTypeProvider(new[] { type }); - var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var options = new MockMvcOptionsAccessor(); options.Options.Conventions.Add(convention); @@ -1413,23 +1405,19 @@ namespace Microsoft.AspNet.Mvc.Test controllerTypeProvider, modelBuilder, new TestGlobalFilterProvider(), - options, - new NullLoggerFactory()); + options); } private IEnumerable GetDescriptors(params TypeInfo[] controllerTypeInfos) { var controllerTypeProvider = new FixedSetControllerTypeProvider(controllerTypeInfos); - var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var provider = new ControllerActionDescriptorProvider( controllerTypeProvider, modelBuilder, new TestGlobalFilterProvider(), - new MockMvcOptionsAccessor(), - new NullLoggerFactory()); + new MockMvcOptionsAccessor()); return provider.GetDescriptors(); } diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerModelValuesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerModelValuesTest.cs deleted file mode 100644 index b1b089943e..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerModelValuesTest.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.ApplicationModels; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Logging -{ - public class ControllerModelValuesTest - { - [Fact] - public void ControllerModelValues_IncludesAllProperties() - { - // Arrange - var exclude = new[] { "Application" }; - - // Assert - PropertiesAssert.PropertiesAreTheSame( - typeof(ControllerModel), - typeof(ControllerModelValues), - exclude); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionDescriptorCollectionProviderLoggingTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionDescriptorCollectionProviderLoggingTest.cs deleted file mode 100644 index 64180ed37e..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionDescriptorCollectionProviderLoggingTest.cs +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.ComponentModel.Design; -using System.Linq; -using System.Reflection; -using Microsoft.AspNet.Authorization; -using Microsoft.AspNet.Mvc.ApplicationModels; -using Microsoft.AspNet.Mvc.Core; -using Microsoft.Framework.Logging; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Logging -{ - public class DefaultActionDescriptorCollectionProviderLoggingTest - { - [Fact] - public void ControllerDiscovery() - { - // Arrange - var sink = new TestSink(); - var loggerFactory = new TestLoggerFactory(sink); - - // Act - var provider = GetProvider( - loggerFactory, - typeof(SimpleController).GetTypeInfo(), - typeof(BasicController).GetTypeInfo()); - provider.GetDescriptors(); - - // Assert - // 2 controllers - Assert.Equal(2, sink.Writes.Count); - - var controllerModelValues = Assert.IsType(sink.Writes[0].State); - Assert.NotNull(controllerModelValues); - Assert.Equal("Simple", controllerModelValues.ControllerName); - Assert.Equal(typeof(SimpleController), controllerModelValues.ControllerType); - Assert.Single(controllerModelValues.Actions); - Assert.Empty(controllerModelValues.AttributeRoutes); - Assert.Empty(controllerModelValues.RouteConstraints); - Assert.Empty(controllerModelValues.Attributes); - Assert.Empty(controllerModelValues.Filters); - - controllerModelValues = Assert.IsType(sink.Writes[1].State); - Assert.NotNull(controllerModelValues); - Assert.Equal("Basic", controllerModelValues.ControllerName); - Assert.Equal(typeof(BasicController), controllerModelValues.ControllerType); - Assert.Equal(2, controllerModelValues.Actions.Count); - Assert.Equal("GET", controllerModelValues.Actions[0].HttpMethods.FirstOrDefault()); - Assert.Equal("POST", controllerModelValues.Actions[1].HttpMethods.FirstOrDefault()); - Assert.Empty(controllerModelValues.AttributeRoutes); - Assert.Empty(controllerModelValues.RouteConstraints); - Assert.NotEmpty(controllerModelValues.Attributes); - Assert.Single(controllerModelValues.Filters); - } - - [Fact] - public void ActionDiscovery() - { - // Arrange - var sink = new TestSink(); - var loggerFactory = new TestLoggerFactory(sink); - - // Act - CreateActionDescriptors(loggerFactory, - typeof(SimpleController).GetTypeInfo(), - typeof(BasicController).GetTypeInfo()); - - // Assert - // 2 controllers, 3 actions - Assert.Equal(5, sink.Writes.Count); - Assert.IsType(sink.Writes[0].State); - Assert.IsType(sink.Writes[1].State); - - var actionDescriptorValues = Assert.IsType(sink.Writes[2].State); - Assert.NotNull(actionDescriptorValues); - Assert.Equal("EmptyAction", actionDescriptorValues.Name); - Assert.Equal("Simple", actionDescriptorValues.ControllerName); - Assert.Equal(typeof(SimpleController), actionDescriptorValues.ControllerTypeInfo); - Assert.Null(actionDescriptorValues.AttributeRouteInfo.Name); - Assert.Null(actionDescriptorValues.ActionConstraints); - Assert.Empty(actionDescriptorValues.FilterDescriptors); - Assert.Empty(actionDescriptorValues.Parameters); - - actionDescriptorValues = Assert.IsType(sink.Writes[3].State); - Assert.NotNull(actionDescriptorValues); - Assert.Equal("Basic", actionDescriptorValues.Name); - Assert.Equal("Basic", actionDescriptorValues.ControllerName); - Assert.Equal(typeof(BasicController), actionDescriptorValues.ControllerTypeInfo); - Assert.Null(actionDescriptorValues.AttributeRouteInfo.Name); - Assert.NotEmpty(actionDescriptorValues.ActionConstraints); - Assert.Equal(2, actionDescriptorValues.FilterDescriptors.Count); - Assert.Empty(actionDescriptorValues.Parameters); - - actionDescriptorValues = Assert.IsType(sink.Writes[4].State); - Assert.NotNull(actionDescriptorValues); - Assert.Equal("Basic", actionDescriptorValues.Name); - Assert.Equal("Basic", actionDescriptorValues.ControllerName); - Assert.Equal(typeof(BasicController), actionDescriptorValues.ControllerTypeInfo); - Assert.Null(actionDescriptorValues.AttributeRouteInfo.Name); - Assert.NotEmpty(actionDescriptorValues.ActionConstraints); - Assert.Single(actionDescriptorValues.FilterDescriptors); - Assert.Single(actionDescriptorValues.RouteConstraints); - Assert.Single(actionDescriptorValues.Parameters); - } - - private void CreateActionDescriptors(ILoggerFactory loggerFactory, params TypeInfo[] controllerTypeInfo) - { - var actionDescriptorProvider = GetProvider(loggerFactory, controllerTypeInfo); - - // service container does not work quite like our built in Depenency Injection container. - var serviceContainer = new ServiceContainer(); - var list = new List() - { - actionDescriptorProvider, - }; - - serviceContainer.AddService(typeof(IEnumerable), list); - - var actionCollectionDescriptorProvider = new DefaultActionDescriptorsCollectionProvider(serviceContainer, loggerFactory); - var descriptors = actionCollectionDescriptorProvider.ActionDescriptors; - } - - private ControllerActionDescriptorProvider GetProvider( - ILoggerFactory loggerFactory, params TypeInfo[] controllerTypeInfo) - { - var controllerTypeProvider = new FixedSetControllerTypeProvider(controllerTypeInfo); - var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - loggerFactory, - null); - - var provider = new ControllerActionDescriptorProvider( - controllerTypeProvider, - modelBuilder, - new TestGlobalFilterProvider(), - new MockMvcOptionsAccessor(), - loggerFactory); - - return provider; - } - - private class SimpleController - { - public void EmptyAction() { } - } - - [Authorize] - private class BasicController - { - [HttpGet] - [AllowAnonymous] - public void Basic() { } - - [HttpPost] - [Route("/Basic")] - public void Basic(int id) { } - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionSelectorTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionSelectorTests.cs index f87a3bb813..cbd1a70fdf 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionSelectorTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionSelectorTests.cs @@ -13,7 +13,6 @@ using Microsoft.AspNet.Http.Core.Collections; using Microsoft.AspNet.Mvc.ActionConstraints; using Microsoft.AspNet.Mvc.ApplicationModels; using Microsoft.AspNet.Mvc.Core; -using Microsoft.AspNet.Mvc.Logging; using Microsoft.AspNet.Mvc.Routing; using Microsoft.AspNet.Routing; using Microsoft.Framework.Internal; @@ -645,7 +644,7 @@ namespace Microsoft.AspNet.Mvc serviceContainer.AddService(typeof(IEnumerable), list); - var actionCollectionDescriptorProvider = new DefaultActionDescriptorsCollectionProvider(serviceContainer, new NullLoggerFactory()); + var actionCollectionDescriptorProvider = new DefaultActionDescriptorsCollectionProvider(serviceContainer); var decisionTreeProvider = new ActionSelectorDecisionTreeProvider(actionCollectionDescriptorProvider); var actionConstraintProviders = new IActionConstraintProvider[] { @@ -669,16 +668,13 @@ namespace Microsoft.AspNet.Mvc .ToList(); var controllerTypeProvider = new FixedSetControllerTypeProvider(controllerTypes); - var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - NullLoggerFactory.Instance, - null); + var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); return new ControllerActionDescriptorProvider( controllerTypeProvider, modelBuilder, new TestGlobalFilterProvider(), - new MockMvcOptionsAccessor(), - new NullLoggerFactory()); + new MockMvcOptionsAccessor()); } private static HttpContext GetHttpContext(string httpMethod) diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/FilterDescriptorValuesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/FilterDescriptorValuesTest.cs deleted file mode 100644 index 4850d4d5c8..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/FilterDescriptorValuesTest.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.Logging; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Test.Logging -{ - public class FilterDescriptorValuesTest - { - [Fact] - public void FilterDescriptorValues_IncludesAllProperties() - { - // Assert - PropertiesAssert.PropertiesAreTheSame( - typeof(FilterDescriptor), - typeof(FilterDescriptorValues)); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/FilterValuesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/FilterValuesTest.cs deleted file mode 100644 index 446273d69e..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/FilterValuesTest.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Logging -{ - public class FilterValuesTest - { - [Fact] - public void IFilter_InitializesCorrectValues() - { - // Arrange - var filter = new TestFilter(); - - // Act - var filterValues = new FilterValues(filter); - - // Assert - Assert.False(filterValues.IsFactory); - Assert.Null(filterValues.FilterType); - Assert.Equal(typeof(TestFilter), filterValues.FilterMetadataType); - Assert.Equal( - new List() { typeof(IFilter), typeof(IExceptionFilter) }, - filterValues.FilterInterfaces); - } - - [Fact] - public void IFilterFactory_InitializesCorrectValues() - { - // Arrange - var filter = new TestFactory(); - - // Act - var filterValues = new FilterValues(filter); - - // Assert - Assert.True(filterValues.IsFactory); - Assert.Null(filterValues.FilterType); - Assert.Equal(typeof(TestFactory), filterValues.FilterMetadataType); - Assert.Equal( - new List() { typeof(IFilterFactory), typeof(IFilter) }, - filterValues.FilterInterfaces); - } - - [Fact] - public void ServiceFilterAttribute_InitializesCorrectValues() - { - // Arrange - var filter = new ServiceFilterAttribute(typeof(TestFilter)); - - // Act - var filterValues = new FilterValues(filter); - - // Assert - Assert.True(filterValues.IsFactory); - Assert.Equal(typeof(TestFilter), filterValues.FilterType); - Assert.Equal(typeof(ServiceFilterAttribute), filterValues.FilterMetadataType); - Assert.Equal( - new List() { typeof(IFilter), typeof(IExceptionFilter) }, - filterValues.FilterInterfaces); - } - - [Fact] - public void TypeFilterAttribute_InitializesCorrectValues() - { - // Arrange - var filter = new TypeFilterAttribute(typeof(TestFilter)); - - // Act - var filterValues = new FilterValues(filter); - - // Assert - Assert.True(filterValues.IsFactory); - Assert.Equal(typeof(TestFilter), filterValues.FilterType); - Assert.Equal(typeof(TypeFilterAttribute), filterValues.FilterMetadataType); - Assert.Equal( - new List() { typeof(IFilter), typeof(IExceptionFilter) }, - filterValues.FilterInterfaces); - } - - private class TestFilter : IFilter, IExceptionFilter - { - public void OnException(ExceptionContext context) - { - } - } - - private class TestFactory : IFilterFactory - { - public IFilter CreateInstance(IServiceProvider serviceProvider) - { - return new TestFilter(); - } - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/KnownRouteValueConstraintTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/KnownRouteValueConstraintTests.cs index 7eb4ddf48f..172f5edad8 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/KnownRouteValueConstraintTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/KnownRouteValueConstraintTests.cs @@ -172,7 +172,7 @@ namespace Microsoft.AspNet.Routing.Tests context.Setup(o => o.RequestServices .GetService(typeof(IActionDescriptorsCollectionProvider))) - .Returns(new DefaultActionDescriptorsCollectionProvider(context.Object.RequestServices, new NullLoggerFactory())); + .Returns(new DefaultActionDescriptorsCollectionProvider(context.Object.RequestServices)); return context.Object; } diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/RouteConstraintProviderValuesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/RouteConstraintProviderValuesTest.cs deleted file mode 100644 index a0c28a100c..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/RouteConstraintProviderValuesTest.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Xunit; - -namespace Microsoft.AspNet.Mvc.Logging -{ - public class RouteConstraintProviderValuesTest - { - [Fact] - public void RouteConstraintProviderValues_IncludesAllProperties() - { - // Arrange - var exclude = new[] { "TypeId" }; - - // Assert - PropertiesAssert.PropertiesAreTheSame( - typeof(RouteConstraintAttribute), - typeof(RouteConstraintProviderValues), - exclude); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/RouteDataActionConstraintValuesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/RouteDataActionConstraintValuesTest.cs deleted file mode 100644 index 63b6d4311d..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/RouteDataActionConstraintValuesTest.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Xunit; - -namespace Microsoft.AspNet.Mvc.Logging -{ - public class RouteDataActionConstraintValuesTest - { - [Fact] - public void RouteDataActionConstraintValues_IncludesAllProperties() - { - // Assert - PropertiesAssert.PropertiesAreTheSame( - typeof(RouteDataActionConstraint), - typeof(RouteDataActionConstraintValues)); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingStartupTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingStartupTest.cs deleted file mode 100644 index a7bfd58c01..0000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingStartupTest.cs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if DNX451 // Since Json.net serialization fails in CoreCLR -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Threading.Tasks; -using LoggingWebSite; -using LoggingWebSite.Controllers; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Mvc.Filters; -using Microsoft.AspNet.Mvc.Logging; -using Microsoft.Framework.DependencyInjection; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class LoggingStartupTest - { - private const string SiteName = nameof(LoggingWebSite); - private readonly Action _app = new Startup().Configure; - private readonly Action _configureServices = new Startup().ConfigureServices; - - [Fact] - public async Task AssemblyValues_LoggedAtStartup() - { - // Arrange and Act - var logs = await GetLogsByDataTypeAsync(); - - // Assert - Assert.NotEmpty(logs); - foreach (var log in logs) - { - dynamic assembly = log.State; - Assert.NotNull(assembly); - Assert.Equal( - "LoggingWebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", - assembly.AssemblyName.ToString()); - } - } - - [Fact] - public async Task ControllerModelValues_LoggedAtStartup() - { - // Arrange and Act - var logs = await GetLogsByDataTypeAsync(); - - // Assert - Assert.Single(logs); - dynamic controller = logs.First().State; - Assert.Equal("Home", controller.ControllerName.ToString()); - Assert.Equal(typeof(HomeController).AssemblyQualifiedName, controller.ControllerType.ToString()); - Assert.Equal("Index", controller.Actions[0].ActionName.ToString()); - Assert.Empty(controller.ApiExplorer.IsVisible); - Assert.Empty(controller.ApiExplorer.GroupName.ToString()); - Assert.Empty(controller.Attributes); - Assert.Empty(controller.ActionConstraints); - Assert.Empty(controller.RouteConstraints); - Assert.Empty(controller.AttributeRoutes); - - var filter = Assert.Single(controller.Filters); - Assert.Equal(typeof(ControllerActionFilter).AssemblyQualifiedName, (string)filter.FilterMetadataType); - } - - [Fact] - public async Task ActionDescriptorValues_LoggedAtStartup() - { - // Arrange and Act - var logs = await GetLogsByDataTypeAsync(); - - // Assert - Assert.Single(logs); - dynamic action = logs.First().State; - Assert.Equal("Index", action.Name.ToString()); - Assert.Empty(action.Parameters); - Assert.Equal("action", action.RouteConstraints[0].RouteKey.ToString()); - Assert.Equal("controller", action.RouteConstraints[1].RouteKey.ToString()); - Assert.Empty(action.RouteValueDefaults); - Assert.Empty(action.ActionConstraints.ToString()); - Assert.Empty(action.HttpMethods.ToString()); - Assert.Empty(action.Properties); - Assert.Equal("Home", action.ControllerName.ToString()); - - var filter = Assert.Single(action.FilterDescriptors).Filter; - Assert.Equal(typeof(ControllerActionFilter).AssemblyQualifiedName, (string)filter.FilterMetadataType); - } - - private async Task> GetLogsByDataTypeAsync() - { - var server = TestHelper.CreateServer(_app, SiteName, _configureServices); - var client = server.CreateClient(); - - var requestTraceId = Guid.NewGuid().ToString(); - - var response = await client.GetAsync(string.Format( - "http://localhost/home/index?{0}={1}", - LoggingExtensions.RequestTraceIdQueryKey, - requestTraceId)); - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - response = await client.GetAsync("http://localhost/logs"); - - var body = await response.Content.ReadAsStringAsync(); - var activityDtos = JsonConvert.DeserializeObject>(body); - - return activityDtos.GetLogsByDataType(); - } - } -} -#endif diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultModelMetadataTest.cs b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultModelMetadataTest.cs index e5273826a9..7fbe56a6ba 100644 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultModelMetadataTest.cs +++ b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultModelMetadataTest.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; #if !DNXCORE50 using Moq; #endif diff --git a/test/Microsoft.AspNet.Mvc.WebApiCompatShimTest/ApiControllerActionDiscoveryTest.cs b/test/Microsoft.AspNet.Mvc.WebApiCompatShimTest/ApiControllerActionDiscoveryTest.cs index c306406778..e0e175d0d9 100644 --- a/test/Microsoft.AspNet.Mvc.WebApiCompatShimTest/ApiControllerActionDiscoveryTest.cs +++ b/test/Microsoft.AspNet.Mvc.WebApiCompatShimTest/ApiControllerActionDiscoveryTest.cs @@ -12,7 +12,6 @@ using Microsoft.AspNet.Mvc.Core; using Microsoft.AspNet.Mvc.Filters; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.WebApiCompatShim; -using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; using Moq; using Xunit; @@ -373,9 +372,7 @@ namespace System.Web.Http var assemblyProvider = new FixedSetAssemblyProvider(); assemblyProvider.CandidateAssemblies.Add(GetType().GetTypeInfo().Assembly); var controllerTypeProvider = new NamespaceFilteredControllerTypeProvider(assemblyProvider); - var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), - new LoggerFactory(), - null); + var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var filterProvider = new Mock(); filterProvider @@ -396,8 +393,7 @@ namespace System.Web.Http controllerTypeProvider, modelBuilder, filterProvider.Object, - optionsAccessor.Object, - new LoggerFactory()); + optionsAccessor.Object); return provider; }