Use factory pattern for caching in ControllerActionInvoker
This commit is contained in:
parent
9d38e2523c
commit
c5f771d96d
|
|
@ -0,0 +1,91 @@
|
||||||
|
// Copyright (c) .NET Foundation. 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.Reflection;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Core;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides methods to create an MVC controller.
|
||||||
|
/// </summary>
|
||||||
|
public class ControllerActivatorProvider : IControllerActivatorProvider
|
||||||
|
{
|
||||||
|
private static readonly Func<Type, ObjectFactory> _createFactory = (type) => ActivatorUtilities.CreateFactory(type, Type.EmptyTypes);
|
||||||
|
private static readonly Action<ControllerContext, object> _dispose = Dispose;
|
||||||
|
private readonly Func<ControllerContext, object> _controllerActivatorCreate;
|
||||||
|
private readonly Action<ControllerContext, object> _controllerActivatorRelease;
|
||||||
|
|
||||||
|
public ControllerActivatorProvider(IControllerActivator controllerActivator)
|
||||||
|
{
|
||||||
|
if (controllerActivator == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(controllerActivator));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compat: Delegate to controllerActivator if it's not the default implementation.
|
||||||
|
if (controllerActivator.GetType() != typeof(DefaultControllerActivator))
|
||||||
|
{
|
||||||
|
_controllerActivatorCreate = controllerActivator.Create;
|
||||||
|
_controllerActivatorRelease = controllerActivator.Release;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Func<ControllerContext, object> CreateActivator(ControllerActionDescriptor descriptor)
|
||||||
|
{
|
||||||
|
if (descriptor == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(descriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
var controllerType = descriptor.ControllerTypeInfo?.AsType();
|
||||||
|
if (controllerType == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException(Resources.FormatPropertyOfTypeCannotBeNull(
|
||||||
|
nameof(descriptor.ControllerTypeInfo),
|
||||||
|
nameof(descriptor)),
|
||||||
|
nameof(descriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_controllerActivatorCreate != null)
|
||||||
|
{
|
||||||
|
return _controllerActivatorCreate;
|
||||||
|
}
|
||||||
|
|
||||||
|
var typeActivator = ActivatorUtilities.CreateFactory(controllerType, Type.EmptyTypes);
|
||||||
|
return controllerContext => typeActivator(controllerContext.HttpContext.RequestServices, arguments: null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action<ControllerContext, object> CreateReleaser(ControllerActionDescriptor descriptor)
|
||||||
|
{
|
||||||
|
if (descriptor == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(descriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_controllerActivatorRelease != null)
|
||||||
|
{
|
||||||
|
return _controllerActivatorRelease;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof(IDisposable).GetTypeInfo().IsAssignableFrom(descriptor.ControllerTypeInfo))
|
||||||
|
{
|
||||||
|
return _dispose;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Dispose(ControllerContext context, object controller)
|
||||||
|
{
|
||||||
|
if (controller == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(controller));
|
||||||
|
}
|
||||||
|
|
||||||
|
((IDisposable)controller).Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
// Copyright (c) .NET Foundation. 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.AspNetCore.Mvc.Core;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Internal;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
|
{
|
||||||
|
public class ControllerFactoryProvider : IControllerFactoryProvider
|
||||||
|
{
|
||||||
|
private readonly IControllerActivatorProvider _activatorProvider;
|
||||||
|
private readonly Func<ControllerContext, object> _factoryCreateController;
|
||||||
|
private readonly Action<ControllerContext, object> _factoryReleaseController;
|
||||||
|
private readonly IControllerPropertyActivator[] _propertyActivators;
|
||||||
|
|
||||||
|
public ControllerFactoryProvider(
|
||||||
|
IControllerActivatorProvider activatorProvider,
|
||||||
|
IControllerFactory controllerFactory,
|
||||||
|
IEnumerable<IControllerPropertyActivator> propertyActivators)
|
||||||
|
{
|
||||||
|
if (activatorProvider == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(activatorProvider));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (controllerFactory == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(controllerFactory));
|
||||||
|
}
|
||||||
|
|
||||||
|
_activatorProvider = activatorProvider;
|
||||||
|
|
||||||
|
// Compat: Delegate to the IControllerFactory if it's not the default implementation.
|
||||||
|
if (controllerFactory.GetType() != typeof(DefaultControllerFactory))
|
||||||
|
{
|
||||||
|
_factoryCreateController = controllerFactory.CreateController;
|
||||||
|
_factoryReleaseController = controllerFactory.ReleaseController;
|
||||||
|
}
|
||||||
|
|
||||||
|
_propertyActivators = propertyActivators.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Func<ControllerContext, object> CreateControllerFactory(ControllerActionDescriptor descriptor)
|
||||||
|
{
|
||||||
|
if (descriptor == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(descriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
var controllerType = descriptor.ControllerTypeInfo?.AsType();
|
||||||
|
if (controllerType == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException(Resources.FormatPropertyOfTypeCannotBeNull(
|
||||||
|
nameof(descriptor.ControllerTypeInfo),
|
||||||
|
nameof(descriptor)),
|
||||||
|
nameof(descriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_factoryCreateController != null)
|
||||||
|
{
|
||||||
|
return _factoryCreateController;
|
||||||
|
}
|
||||||
|
|
||||||
|
var controllerActivator = _activatorProvider.CreateActivator(descriptor);
|
||||||
|
var propertyActivators = GetPropertiesToActivate(descriptor);
|
||||||
|
object CreateController(ControllerContext controllerContext)
|
||||||
|
{
|
||||||
|
var controller = controllerActivator(controllerContext);
|
||||||
|
for (var i = 0; i < propertyActivators.Length; i++)
|
||||||
|
{
|
||||||
|
var propertyActivator = propertyActivators[i];
|
||||||
|
propertyActivator(controllerContext, controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
return controller;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreateController;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action<ControllerContext, object> CreateControllerReleaser(ControllerActionDescriptor descriptor)
|
||||||
|
{
|
||||||
|
if (descriptor == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(descriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
var controllerType = descriptor.ControllerTypeInfo?.AsType();
|
||||||
|
if (controllerType == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException(Resources.FormatPropertyOfTypeCannotBeNull(
|
||||||
|
nameof(descriptor.ControllerTypeInfo),
|
||||||
|
nameof(descriptor)),
|
||||||
|
nameof(descriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_factoryReleaseController != null)
|
||||||
|
{
|
||||||
|
return _factoryReleaseController;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _activatorProvider.CreateReleaser(descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Action<ControllerContext, object>[] GetPropertiesToActivate(ControllerActionDescriptor actionDescriptor)
|
||||||
|
{
|
||||||
|
var propertyActivators = new Action<ControllerContext, object>[_propertyActivators.Length];
|
||||||
|
for (var i = 0; i < _propertyActivators.Length; i++)
|
||||||
|
{
|
||||||
|
var activatorProvider = _propertyActivators[i];
|
||||||
|
propertyActivators[i] = activatorProvider.GetActivatorDelegate(actionDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
return propertyActivators;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides methods to create a MVC controller.
|
||||||
|
/// </summary>
|
||||||
|
public interface IControllerActivatorProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a <see cref="Func{T, TResult}"/> that creates a controller.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="descriptor">The <see cref="ControllerActionDescriptor"/>.</param>
|
||||||
|
/// <returns>The delegate used to activate the controller.</returns>
|
||||||
|
Func<ControllerContext, object> CreateActivator(ControllerActionDescriptor descriptor);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an <see cref="Action"/> that releases a controller.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="descriptor">The <see cref="ControllerActionDescriptor"/>.</param>
|
||||||
|
/// <returns>The delegate used to dispose the activated controller.</returns>
|
||||||
|
Action<ControllerContext, object> CreateReleaser(ControllerActionDescriptor descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides methods to create and release a controller.
|
||||||
|
/// </summary>
|
||||||
|
public interface IControllerFactoryProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a factory for producing controllers for the specified <paramref name="descriptor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="descriptor">The <see cref="ControllerActionDescriptor"/>.</param>
|
||||||
|
/// <returns>The controller factory.</returns>
|
||||||
|
Func<ControllerContext, object> CreateControllerFactory(ControllerActionDescriptor descriptor);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Releases a controller.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="descriptor">The <see cref="ControllerActionDescriptor"/>.</param>
|
||||||
|
/// <returns>The delegate used to release the created controller.</returns>
|
||||||
|
Action<ControllerContext, object> CreateControllerReleaser(ControllerActionDescriptor descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -157,6 +157,9 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
|
|
||||||
// Will be cached by the DefaultControllerFactory
|
// Will be cached by the DefaultControllerFactory
|
||||||
services.TryAddTransient<IControllerActivator, DefaultControllerActivator>();
|
services.TryAddTransient<IControllerActivator, DefaultControllerActivator>();
|
||||||
|
|
||||||
|
services.TryAddSingleton<IControllerFactoryProvider, ControllerFactoryProvider>();
|
||||||
|
services.TryAddSingleton<IControllerActivatorProvider, ControllerActivatorProvider>();
|
||||||
services.TryAddEnumerable(
|
services.TryAddEnumerable(
|
||||||
ServiceDescriptor.Transient<IControllerPropertyActivator, DefaultControllerPropertyActivator>());
|
ServiceDescriptor.Transient<IControllerPropertyActivator, DefaultControllerPropertyActivator>());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,8 @@ using System.Diagnostics;
|
||||||
using System.Runtime.ExceptionServices;
|
using System.Runtime.ExceptionServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Mvc.Abstractions;
|
using Microsoft.AspNetCore.Mvc.Abstractions;
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Core;
|
using Microsoft.AspNetCore.Mvc.Core;
|
||||||
using Microsoft.AspNetCore.Mvc.Core.Internal;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
||||||
using Microsoft.Extensions.Internal;
|
using Microsoft.Extensions.Internal;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|
@ -19,12 +16,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public class ControllerActionInvoker : ResourceInvoker, IActionInvoker
|
public class ControllerActionInvoker : ResourceInvoker, IActionInvoker
|
||||||
{
|
{
|
||||||
private readonly IControllerFactory _controllerFactory;
|
private readonly ControllerActionInvokerCacheEntry _cacheEntry;
|
||||||
private readonly ParameterBinder _parameterBinder;
|
|
||||||
private readonly IModelMetadataProvider _modelMetadataProvider;
|
|
||||||
|
|
||||||
private readonly ControllerContext _controllerContext;
|
private readonly ControllerContext _controllerContext;
|
||||||
private readonly ObjectMethodExecutor _executor;
|
|
||||||
|
|
||||||
private object _controller;
|
private object _controller;
|
||||||
private Dictionary<string, object> _arguments;
|
private Dictionary<string, object> _arguments;
|
||||||
|
|
@ -38,44 +31,27 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
private ResultExecutedContext _resultExecutedContext;
|
private ResultExecutedContext _resultExecutedContext;
|
||||||
|
|
||||||
internal ControllerActionInvoker(
|
internal ControllerActionInvoker(
|
||||||
IControllerFactory controllerFactory,
|
|
||||||
ParameterBinder parameterBinder,
|
|
||||||
IModelMetadataProvider modelMetadataProvider,
|
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
DiagnosticSource diagnosticSource,
|
DiagnosticSource diagnosticSource,
|
||||||
ControllerContext controllerContext,
|
ControllerContext controllerContext,
|
||||||
IFilterMetadata[] filters,
|
ControllerActionInvokerCacheEntry cacheEntry,
|
||||||
ObjectMethodExecutor objectMethodExecutor)
|
IFilterMetadata[] filters)
|
||||||
: base(diagnosticSource, logger, controllerContext, filters, controllerContext.ValueProviderFactories)
|
: base(diagnosticSource, logger, controllerContext, filters, controllerContext.ValueProviderFactories)
|
||||||
{
|
{
|
||||||
|
if (cacheEntry == null)
|
||||||
if (controllerFactory == null)
|
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(controllerFactory));
|
throw new ArgumentNullException(nameof(cacheEntry));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameterBinder == null)
|
_cacheEntry = cacheEntry;
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(parameterBinder));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (objectMethodExecutor == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(objectMethodExecutor));
|
|
||||||
}
|
|
||||||
|
|
||||||
_controllerFactory = controllerFactory;
|
|
||||||
_parameterBinder = parameterBinder;
|
|
||||||
_modelMetadataProvider = modelMetadataProvider;
|
|
||||||
_controllerContext = controllerContext;
|
_controllerContext = controllerContext;
|
||||||
_executor = objectMethodExecutor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ReleaseResources()
|
protected override void ReleaseResources()
|
||||||
{
|
{
|
||||||
if (_controller != null)
|
if (_controller != null && _cacheEntry.ControllerReleaser != null)
|
||||||
{
|
{
|
||||||
_controllerFactory.ReleaseController(_controllerContext, _controller);
|
_cacheEntry.ControllerReleaser(_controllerContext, _controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,7 +269,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
||||||
_cursor.Reset();
|
_cursor.Reset();
|
||||||
|
|
||||||
_controller = _controllerFactory.CreateController(controllerContext);
|
_controller = _cacheEntry.ControllerFactory(controllerContext);
|
||||||
|
|
||||||
_arguments = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
_arguments = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
|
@ -757,7 +733,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
private async Task InvokeActionMethodAsync()
|
private async Task InvokeActionMethodAsync()
|
||||||
{
|
{
|
||||||
var controllerContext = _controllerContext;
|
var controllerContext = _controllerContext;
|
||||||
var executor = _executor;
|
var executor = _cacheEntry.ActionMethodExecutor;
|
||||||
var controller = _controller;
|
var controller = _controller;
|
||||||
var arguments = _arguments;
|
var arguments = _arguments;
|
||||||
var orderedArguments = PrepareArguments(arguments, executor);
|
var orderedArguments = PrepareArguments(arguments, executor);
|
||||||
|
|
@ -799,24 +775,24 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
Resources.FormatActionResult_ActionReturnValueCannotBeNull(typeof(IActionResult)));
|
Resources.FormatActionResult_ActionReturnValueCannotBeNull(typeof(IActionResult)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IsResultIActionResult(_executor))
|
else if (IsResultIActionResult(executor))
|
||||||
{
|
{
|
||||||
if (_executor.IsMethodAsync)
|
if (executor.IsMethodAsync)
|
||||||
{
|
{
|
||||||
// Async method returning awaitable-of-IActionResult (e.g., Task<ViewResult>)
|
// Async method returning awaitable-of-IActionResult (e.g., Task<ViewResult>)
|
||||||
// We have to use ExecuteAsync because we don't know the awaitable's type at compile time.
|
// We have to use ExecuteAsync because we don't know the awaitable's type at compile time.
|
||||||
result = (IActionResult)await _executor.ExecuteAsync(controller, orderedArguments);
|
result = (IActionResult)await executor.ExecuteAsync(controller, orderedArguments);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Sync method returning IActionResult (e.g., ViewResult)
|
// Sync method returning IActionResult (e.g., ViewResult)
|
||||||
result = (IActionResult)_executor.Execute(controller, orderedArguments);
|
result = (IActionResult)executor.Execute(controller, orderedArguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
Resources.FormatActionResult_ActionReturnValueCannotBeNull(_executor.AsyncResultType ?? returnType));
|
Resources.FormatActionResult_ActionReturnValueCannotBeNull(executor.AsyncResultType ?? returnType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!executor.IsMethodAsync)
|
else if (!executor.IsMethodAsync)
|
||||||
|
|
@ -1004,63 +980,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
return TaskCache.CompletedTask;
|
return TaskCache.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BindArgumentsCoreAsync(_parameterBinder, _modelMetadataProvider, _controllerContext, _controller, _arguments);
|
Debug.Assert(_cacheEntry.ControllerBinderDelegate != null);
|
||||||
}
|
return _cacheEntry.ControllerBinderDelegate(_controllerContext, _controller, _arguments);
|
||||||
|
|
||||||
// Intentionally static internal for unit testing
|
|
||||||
internal static async Task BindArgumentsCoreAsync(
|
|
||||||
ParameterBinder parameterBinder,
|
|
||||||
IModelMetadataProvider modelMetadataProvider,
|
|
||||||
ControllerContext controllerContext,
|
|
||||||
object controller,
|
|
||||||
Dictionary<string, object> arguments)
|
|
||||||
{
|
|
||||||
var valueProvider = await CompositeValueProvider.CreateAsync(controllerContext);
|
|
||||||
|
|
||||||
var parameters = controllerContext.ActionDescriptor.Parameters;
|
|
||||||
for (var i = 0; i < parameters.Count; i++)
|
|
||||||
{
|
|
||||||
var parameter = parameters[i];
|
|
||||||
|
|
||||||
var result = await parameterBinder.BindModelAsync(controllerContext, valueProvider, parameter);
|
|
||||||
if (result.IsModelSet)
|
|
||||||
{
|
|
||||||
arguments[parameter.Name] = result.Model;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var propertyDescriptors = controllerContext.ActionDescriptor.BoundProperties;
|
|
||||||
if (propertyDescriptors.Count == 0)
|
|
||||||
{
|
|
||||||
// Perf: Early exit to avoid PropertyHelper lookup in the (common) case where we have no
|
|
||||||
// bound properties.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var controllerType = controller.GetType();
|
|
||||||
ModelMetadata controllerMetadata = null;
|
|
||||||
for (var i = 0; i < propertyDescriptors.Count; i++)
|
|
||||||
{
|
|
||||||
var property = propertyDescriptors[i];
|
|
||||||
|
|
||||||
var result = await parameterBinder.BindModelAsync(controllerContext, valueProvider, property);
|
|
||||||
if (result.IsModelSet)
|
|
||||||
{
|
|
||||||
if (controllerMetadata == null)
|
|
||||||
{
|
|
||||||
controllerMetadata = modelMetadataProvider.GetMetadataForType(controllerType);
|
|
||||||
}
|
|
||||||
var propertyMetadata = controllerMetadata.Properties[property.Name] ??
|
|
||||||
modelMetadataProvider.GetMetadataForProperty(controllerType, property.Name);
|
|
||||||
if (propertyMetadata != null)
|
|
||||||
{
|
|
||||||
PropertyValueSetter.SetValue(
|
|
||||||
propertyMetadata,
|
|
||||||
controller,
|
|
||||||
result.Model);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static object[] PrepareArguments(
|
private static object[] PrepareArguments(
|
||||||
|
|
@ -1090,7 +1011,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private enum Scope
|
private enum Scope
|
||||||
{
|
{
|
||||||
Resource,
|
Resource,
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,10 @@ using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Mvc.Abstractions;
|
using Microsoft.AspNetCore.Mvc.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
using Microsoft.Extensions.Internal;
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Internal
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
@ -14,16 +16,28 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
public class ControllerActionInvokerCache
|
public class ControllerActionInvokerCache
|
||||||
{
|
{
|
||||||
private readonly IActionDescriptorCollectionProvider _collectionProvider;
|
private readonly IActionDescriptorCollectionProvider _collectionProvider;
|
||||||
|
private readonly ParameterBinder _parameterBinder;
|
||||||
|
private readonly IModelBinderFactory _modelBinderFactory;
|
||||||
|
private readonly IModelMetadataProvider _modelMetadataProvider;
|
||||||
private readonly IFilterProvider[] _filterProviders;
|
private readonly IFilterProvider[] _filterProviders;
|
||||||
|
private readonly IControllerFactoryProvider _controllerFactoryProvider;
|
||||||
|
|
||||||
private volatile InnerCache _currentCache;
|
private volatile InnerCache _currentCache;
|
||||||
|
|
||||||
public ControllerActionInvokerCache(
|
public ControllerActionInvokerCache(
|
||||||
IActionDescriptorCollectionProvider collectionProvider,
|
IActionDescriptorCollectionProvider collectionProvider,
|
||||||
IEnumerable<IFilterProvider> filterProviders)
|
ParameterBinder parameterBinder,
|
||||||
|
IModelBinderFactory modelBinderFactory,
|
||||||
|
IModelMetadataProvider modelMetadataProvider,
|
||||||
|
IEnumerable<IFilterProvider> filterProviders,
|
||||||
|
IControllerFactoryProvider factoryProvider)
|
||||||
{
|
{
|
||||||
_collectionProvider = collectionProvider;
|
_collectionProvider = collectionProvider;
|
||||||
|
_parameterBinder = parameterBinder;
|
||||||
|
_modelBinderFactory = modelBinderFactory;
|
||||||
|
_modelMetadataProvider = modelMetadataProvider;
|
||||||
_filterProviders = filterProviders.OrderBy(item => item.Order).ToArray();
|
_filterProviders = filterProviders.OrderBy(item => item.Order).ToArray();
|
||||||
|
_controllerFactoryProvider = factoryProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
private InnerCache CurrentCache
|
private InnerCache CurrentCache
|
||||||
|
|
@ -43,14 +57,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControllerActionInvokerState GetState(ControllerContext controllerContext)
|
public (ControllerActionInvokerCacheEntry cacheEntry, IFilterMetadata[] filters) GetCachedResult(ControllerContext controllerContext)
|
||||||
{
|
{
|
||||||
var cache = CurrentCache;
|
var cache = CurrentCache;
|
||||||
var actionDescriptor = controllerContext.ActionDescriptor;
|
var actionDescriptor = controllerContext.ActionDescriptor;
|
||||||
|
|
||||||
IFilterMetadata[] filters;
|
IFilterMetadata[] filters;
|
||||||
Entry cacheEntry;
|
if (!cache.Entries.TryGetValue(actionDescriptor, out var cacheEntry))
|
||||||
if (!cache.Entries.TryGetValue(actionDescriptor, out cacheEntry))
|
|
||||||
{
|
{
|
||||||
var filterFactoryResult = FilterFactory.GetAllFilters(_filterProviders, controllerContext);
|
var filterFactoryResult = FilterFactory.GetAllFilters(_filterProviders, controllerContext);
|
||||||
filters = filterFactoryResult.Filters;
|
filters = filterFactoryResult.Filters;
|
||||||
|
|
@ -63,16 +76,29 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
actionDescriptor.ControllerTypeInfo,
|
actionDescriptor.ControllerTypeInfo,
|
||||||
parameterDefaultValues);
|
parameterDefaultValues);
|
||||||
|
|
||||||
cacheEntry = new Entry(filterFactoryResult.CacheableFilters, executor);
|
var controllerFactory = _controllerFactoryProvider.CreateControllerFactory(actionDescriptor);
|
||||||
|
var controllerReleaser = _controllerFactoryProvider.CreateControllerReleaser(actionDescriptor);
|
||||||
|
var propertyBinderFactory = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
|
_parameterBinder,
|
||||||
|
_modelBinderFactory,
|
||||||
|
_modelMetadataProvider,
|
||||||
|
actionDescriptor);
|
||||||
|
|
||||||
|
cacheEntry = new ControllerActionInvokerCacheEntry(
|
||||||
|
filterFactoryResult.CacheableFilters,
|
||||||
|
controllerFactory,
|
||||||
|
controllerReleaser,
|
||||||
|
propertyBinderFactory,
|
||||||
|
executor);
|
||||||
cacheEntry = cache.Entries.GetOrAdd(actionDescriptor, cacheEntry);
|
cacheEntry = cache.Entries.GetOrAdd(actionDescriptor, cacheEntry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Filter instances from statically defined filter descriptors + from filter providers
|
// Filter instances from statically defined filter descriptors + from filter providers
|
||||||
filters = FilterFactory.CreateUncachedFilters(_filterProviders, controllerContext, cacheEntry.FilterItems);
|
filters = FilterFactory.CreateUncachedFilters(_filterProviders, controllerContext, cacheEntry.CachedFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ControllerActionInvokerState(filters, cacheEntry.ActionMethodExecutor);
|
return (cacheEntry, filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class InnerCache
|
private class InnerCache
|
||||||
|
|
@ -82,38 +108,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
Version = version;
|
Version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcurrentDictionary<ActionDescriptor, Entry> Entries { get; } =
|
public ConcurrentDictionary<ActionDescriptor, ControllerActionInvokerCacheEntry> Entries { get; } =
|
||||||
new ConcurrentDictionary<ActionDescriptor, Entry>();
|
new ConcurrentDictionary<ActionDescriptor, ControllerActionInvokerCacheEntry>();
|
||||||
|
|
||||||
public int Version { get; }
|
public int Version { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct Entry
|
|
||||||
{
|
|
||||||
public Entry(FilterItem[] items, ObjectMethodExecutor executor)
|
|
||||||
{
|
|
||||||
FilterItems = items;
|
|
||||||
ActionMethodExecutor = executor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FilterItem[] FilterItems { get; }
|
|
||||||
|
|
||||||
public ObjectMethodExecutor ActionMethodExecutor { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct ControllerActionInvokerState
|
|
||||||
{
|
|
||||||
internal ControllerActionInvokerState(
|
|
||||||
IFilterMetadata[] filters,
|
|
||||||
ObjectMethodExecutor actionMethodExecutor)
|
|
||||||
{
|
|
||||||
Filters = filters;
|
|
||||||
ActionMethodExecutor = actionMethodExecutor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IFilterMetadata[] Filters { get; }
|
|
||||||
|
|
||||||
internal ObjectMethodExecutor ActionMethodExecutor { get; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright (c) .NET Foundation. 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.AspNetCore.Mvc.Filters;
|
||||||
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
{
|
||||||
|
public class ControllerActionInvokerCacheEntry
|
||||||
|
{
|
||||||
|
internal ControllerActionInvokerCacheEntry(
|
||||||
|
FilterItem[] cachedFilters,
|
||||||
|
Func<ControllerContext, object> controllerFactory,
|
||||||
|
Action<ControllerContext, object> controllerReleaser,
|
||||||
|
ControllerBinderDelegate controllerBinderDelegate,
|
||||||
|
ObjectMethodExecutor actionMethodExecutor)
|
||||||
|
{
|
||||||
|
ControllerFactory = controllerFactory;
|
||||||
|
ControllerReleaser = controllerReleaser;
|
||||||
|
ControllerBinderDelegate = controllerBinderDelegate;
|
||||||
|
CachedFilters = cachedFilters;
|
||||||
|
ActionMethodExecutor = actionMethodExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterItem[] CachedFilters { get; }
|
||||||
|
|
||||||
|
public Func<ControllerContext, object> ControllerFactory { get; }
|
||||||
|
|
||||||
|
public Action<ControllerContext, object> ControllerReleaser { get; }
|
||||||
|
|
||||||
|
public ControllerBinderDelegate ControllerBinderDelegate { get; }
|
||||||
|
|
||||||
|
internal ObjectMethodExecutor ActionMethodExecutor { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,38 +15,26 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public class ControllerActionInvokerProvider : IActionInvokerProvider
|
public class ControllerActionInvokerProvider : IActionInvokerProvider
|
||||||
{
|
{
|
||||||
private readonly IControllerFactory _controllerFactory;
|
|
||||||
private readonly ControllerActionInvokerCache _controllerActionInvokerCache;
|
private readonly ControllerActionInvokerCache _controllerActionInvokerCache;
|
||||||
private readonly ParameterBinder _parameterBinder;
|
|
||||||
private readonly IModelMetadataProvider _modelMetadataProvider;
|
|
||||||
private readonly IReadOnlyList<IValueProviderFactory> _valueProviderFactories;
|
private readonly IReadOnlyList<IValueProviderFactory> _valueProviderFactories;
|
||||||
private readonly int _maxModelValidationErrors;
|
private readonly int _maxModelValidationErrors;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly DiagnosticSource _diagnosticSource;
|
private readonly DiagnosticSource _diagnosticSource;
|
||||||
|
|
||||||
public ControllerActionInvokerProvider(
|
public ControllerActionInvokerProvider(
|
||||||
IControllerFactory controllerFactory,
|
|
||||||
ControllerActionInvokerCache controllerActionInvokerCache,
|
ControllerActionInvokerCache controllerActionInvokerCache,
|
||||||
ParameterBinder parameterBinder,
|
|
||||||
IModelMetadataProvider modelMetadataProvider,
|
|
||||||
IOptions<MvcOptions> optionsAccessor,
|
IOptions<MvcOptions> optionsAccessor,
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
DiagnosticSource diagnosticSource)
|
DiagnosticSource diagnosticSource)
|
||||||
{
|
{
|
||||||
_controllerFactory = controllerFactory;
|
|
||||||
_controllerActionInvokerCache = controllerActionInvokerCache;
|
_controllerActionInvokerCache = controllerActionInvokerCache;
|
||||||
_parameterBinder = parameterBinder;
|
|
||||||
_modelMetadataProvider = modelMetadataProvider;
|
|
||||||
_valueProviderFactories = optionsAccessor.Value.ValueProviderFactories.ToArray();
|
_valueProviderFactories = optionsAccessor.Value.ValueProviderFactories.ToArray();
|
||||||
_maxModelValidationErrors = optionsAccessor.Value.MaxModelValidationErrors;
|
_maxModelValidationErrors = optionsAccessor.Value.MaxModelValidationErrors;
|
||||||
_logger = loggerFactory.CreateLogger<ControllerActionInvoker>();
|
_logger = loggerFactory.CreateLogger<ControllerActionInvoker>();
|
||||||
_diagnosticSource = diagnosticSource;
|
_diagnosticSource = diagnosticSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order
|
public int Order => -1000;
|
||||||
{
|
|
||||||
get { return -1000; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnProvidersExecuting(ActionInvokerProviderContext context)
|
public void OnProvidersExecuting(ActionInvokerProviderContext context)
|
||||||
|
|
@ -56,26 +44,21 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
throw new ArgumentNullException(nameof(context));
|
throw new ArgumentNullException(nameof(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
var actionDescriptor = context.ActionContext.ActionDescriptor as ControllerActionDescriptor;
|
if (context.ActionContext.ActionDescriptor is ControllerActionDescriptor actionDescriptor)
|
||||||
|
|
||||||
if (actionDescriptor != null)
|
|
||||||
{
|
{
|
||||||
var controllerContext = new ControllerContext(context.ActionContext);
|
var controllerContext = new ControllerContext(context.ActionContext);
|
||||||
// PERF: These are rarely going to be changed, so let's go copy-on-write.
|
// PERF: These are rarely going to be changed, so let's go copy-on-write.
|
||||||
controllerContext.ValueProviderFactories = new CopyOnWriteList<IValueProviderFactory>(_valueProviderFactories);
|
controllerContext.ValueProviderFactories = new CopyOnWriteList<IValueProviderFactory>(_valueProviderFactories);
|
||||||
controllerContext.ModelState.MaxAllowedErrors = _maxModelValidationErrors;
|
controllerContext.ModelState.MaxAllowedErrors = _maxModelValidationErrors;
|
||||||
|
|
||||||
var cacheState = _controllerActionInvokerCache.GetState(controllerContext);
|
var cacheResult = _controllerActionInvokerCache.GetCachedResult(controllerContext);
|
||||||
|
|
||||||
var invoker = new ControllerActionInvoker(
|
var invoker = new ControllerActionInvoker(
|
||||||
_controllerFactory,
|
|
||||||
_parameterBinder,
|
|
||||||
_modelMetadataProvider,
|
|
||||||
_logger,
|
_logger,
|
||||||
_diagnosticSource,
|
_diagnosticSource,
|
||||||
controllerContext,
|
controllerContext,
|
||||||
cacheState.Filters,
|
cacheResult.cacheEntry,
|
||||||
cacheState.ActionMethodExecutor);
|
cacheResult.filters);
|
||||||
|
|
||||||
context.Result = invoker;
|
context.Result = invoker;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
// Copyright (c) .NET Foundation. 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.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
{
|
||||||
|
public delegate Task ControllerBinderDelegate(
|
||||||
|
ControllerContext controllerContext,
|
||||||
|
object controller,
|
||||||
|
Dictionary<string, object> arguments);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,163 @@
|
||||||
|
// Copyright (c) .NET Foundation. 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.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
{
|
||||||
|
public static class ControllerBinderDelegateProvider
|
||||||
|
{
|
||||||
|
public static ControllerBinderDelegate CreateBinderDelegate(
|
||||||
|
ParameterBinder parameterBinder,
|
||||||
|
IModelBinderFactory modelBinderFactory,
|
||||||
|
IModelMetadataProvider modelMetadataProvider,
|
||||||
|
ControllerActionDescriptor actionDescriptor)
|
||||||
|
{
|
||||||
|
if (parameterBinder == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(parameterBinder));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modelMetadataProvider == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(modelMetadataProvider));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actionDescriptor == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(actionDescriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
var parameterBindingInfo = GetParameterBindingInfo(modelBinderFactory, modelMetadataProvider, actionDescriptor);
|
||||||
|
var propertyBindingInfo = GetPropertyBindingInfo(modelBinderFactory, modelMetadataProvider, actionDescriptor);
|
||||||
|
|
||||||
|
if (parameterBindingInfo == null && propertyBindingInfo == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Bind;
|
||||||
|
|
||||||
|
async Task Bind(ControllerContext controllerContext, object controller, Dictionary<string, object> arguments)
|
||||||
|
{
|
||||||
|
var valueProvider = await CompositeValueProvider.CreateAsync(controllerContext);
|
||||||
|
var parameters = actionDescriptor.Parameters;
|
||||||
|
|
||||||
|
for (var i = 0; i < parameters.Count; i++)
|
||||||
|
{
|
||||||
|
var parameter = parameters[i];
|
||||||
|
var bindingInfo = parameterBindingInfo[i];
|
||||||
|
|
||||||
|
var result = await parameterBinder.BindModelAsync(
|
||||||
|
controllerContext,
|
||||||
|
bindingInfo.ModelBinder,
|
||||||
|
valueProvider,
|
||||||
|
parameter,
|
||||||
|
bindingInfo.ModelMetadata,
|
||||||
|
value: null);
|
||||||
|
|
||||||
|
if (result.IsModelSet)
|
||||||
|
{
|
||||||
|
arguments[parameter.Name] = result.Model;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var properties = actionDescriptor.BoundProperties;
|
||||||
|
for (var i = 0; i < properties.Count; i++)
|
||||||
|
{
|
||||||
|
var property = properties[i];
|
||||||
|
var bindingInfo = propertyBindingInfo[i];
|
||||||
|
|
||||||
|
var result = await parameterBinder.BindModelAsync(
|
||||||
|
controllerContext,
|
||||||
|
bindingInfo.ModelBinder,
|
||||||
|
valueProvider,
|
||||||
|
property,
|
||||||
|
bindingInfo.ModelMetadata,
|
||||||
|
value: null);
|
||||||
|
|
||||||
|
if (result.IsModelSet)
|
||||||
|
{
|
||||||
|
PropertyValueSetter.SetValue(bindingInfo.ModelMetadata, controller, result.Model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BindingInfo[] GetParameterBindingInfo(
|
||||||
|
IModelBinderFactory modelBinderFactory,
|
||||||
|
IModelMetadataProvider modelMetadataProvider,
|
||||||
|
ControllerActionDescriptor actionDescriptor)
|
||||||
|
{
|
||||||
|
var parameters = actionDescriptor.Parameters;
|
||||||
|
if (parameters.Count == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var parameterBindingInfo = new BindingInfo[parameters.Count];
|
||||||
|
for (var i = 0; i < parameters.Count; i++)
|
||||||
|
{
|
||||||
|
var parameter = parameters[i];
|
||||||
|
var metadata = modelMetadataProvider.GetMetadataForType(parameter.ParameterType);
|
||||||
|
var binder = modelBinderFactory.CreateBinder(new ModelBinderFactoryContext
|
||||||
|
{
|
||||||
|
BindingInfo = parameter.BindingInfo,
|
||||||
|
Metadata = metadata,
|
||||||
|
CacheToken = parameter,
|
||||||
|
});
|
||||||
|
|
||||||
|
parameterBindingInfo[i] = new BindingInfo(binder, metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parameterBindingInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BindingInfo[] GetPropertyBindingInfo(
|
||||||
|
IModelBinderFactory modelBinderFactory,
|
||||||
|
IModelMetadataProvider modelMetadataProvider,
|
||||||
|
ControllerActionDescriptor actionDescriptor)
|
||||||
|
{
|
||||||
|
var properties = actionDescriptor.BoundProperties;
|
||||||
|
if (properties.Count == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var propertyBindingInfo = new BindingInfo[properties.Count];
|
||||||
|
var controllerType = actionDescriptor.ControllerTypeInfo.AsType();
|
||||||
|
for (var i = 0; i < properties.Count; i++)
|
||||||
|
{
|
||||||
|
var property = properties[i];
|
||||||
|
var metadata = modelMetadataProvider.GetMetadataForProperty(controllerType, property.Name);
|
||||||
|
var binder = modelBinderFactory.CreateBinder(new ModelBinderFactoryContext
|
||||||
|
{
|
||||||
|
BindingInfo = property.BindingInfo,
|
||||||
|
Metadata = metadata,
|
||||||
|
CacheToken = property,
|
||||||
|
});
|
||||||
|
|
||||||
|
propertyBindingInfo[i] = new BindingInfo(binder, metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
return propertyBindingInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct BindingInfo
|
||||||
|
{
|
||||||
|
public BindingInfo(IModelBinder modelBinder, ModelMetadata modelMetadata)
|
||||||
|
{
|
||||||
|
ModelBinder = modelBinder;
|
||||||
|
ModelMetadata = modelMetadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IModelBinder ModelBinder { get; }
|
||||||
|
|
||||||
|
public ModelMetadata ModelMetadata { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,24 +5,28 @@ using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Core;
|
||||||
using Microsoft.Extensions.Internal;
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Internal
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public class DefaultControllerPropertyActivator : IControllerPropertyActivator
|
public class DefaultControllerPropertyActivator : IControllerPropertyActivator
|
||||||
{
|
{
|
||||||
private readonly ConcurrentDictionary<Type, PropertyActivator<ControllerContext>[]> _activateActions;
|
private static readonly Func<Type, PropertyActivator<ControllerContext>[]> _getPropertiesToActivate =
|
||||||
private readonly Func<Type, PropertyActivator<ControllerContext>[]> _getPropertiesToActivate;
|
GetPropertiesToActivate;
|
||||||
|
private object _initializeLock = new object();
|
||||||
public DefaultControllerPropertyActivator()
|
private bool _initialized;
|
||||||
{
|
private ConcurrentDictionary<Type, PropertyActivator<ControllerContext>[]> _activateActions;
|
||||||
_activateActions = new ConcurrentDictionary<Type, PropertyActivator<ControllerContext>[]>();
|
|
||||||
_getPropertiesToActivate = GetPropertiesToActivate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Activate(ControllerContext context, object controller)
|
public void Activate(ControllerContext context, object controller)
|
||||||
{
|
{
|
||||||
|
LazyInitializer.EnsureInitialized(
|
||||||
|
ref _activateActions,
|
||||||
|
ref _initialized,
|
||||||
|
ref _initializeLock);
|
||||||
|
|
||||||
var controllerType = controller.GetType();
|
var controllerType = controller.GetType();
|
||||||
var propertiesToActivate = _activateActions.GetOrAdd(
|
var propertiesToActivate = _activateActions.GetOrAdd(
|
||||||
controllerType,
|
controllerType,
|
||||||
|
|
@ -35,7 +39,36 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PropertyActivator<ControllerContext>[] GetPropertiesToActivate(Type type)
|
public Action<ControllerContext, object> GetActivatorDelegate(ControllerActionDescriptor actionDescriptor)
|
||||||
|
{
|
||||||
|
if (actionDescriptor == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(actionDescriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
var controllerType = actionDescriptor.ControllerTypeInfo?.AsType();
|
||||||
|
if (controllerType == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException(Resources.FormatPropertyOfTypeCannotBeNull(
|
||||||
|
nameof(actionDescriptor.ControllerTypeInfo),
|
||||||
|
nameof(actionDescriptor)),
|
||||||
|
nameof(actionDescriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
var propertiesToActivate = GetPropertiesToActivate(controllerType);
|
||||||
|
void Activate(ControllerContext controllerContext, object controller)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < propertiesToActivate.Length; i++)
|
||||||
|
{
|
||||||
|
var activateInfo = propertiesToActivate[i];
|
||||||
|
activateInfo.Activate(controller, controllerContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Activate;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PropertyActivator<ControllerContext>[] GetPropertiesToActivate(Type type)
|
||||||
{
|
{
|
||||||
IEnumerable<PropertyActivator<ControllerContext>> activators;
|
IEnumerable<PropertyActivator<ControllerContext>> activators;
|
||||||
activators = PropertyActivator<ControllerContext>.GetPropertiesToActivate(
|
activators = PropertyActivator<ControllerContext>.GetPropertiesToActivate(
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Internal
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public interface IControllerPropertyActivator
|
public interface IControllerPropertyActivator
|
||||||
{
|
{
|
||||||
void Activate(ControllerContext context, object controller);
|
void Activate(ControllerContext context, object controller);
|
||||||
|
|
||||||
|
Action<ControllerContext, object> GetActivatorDelegate(ControllerActionDescriptor actionDescriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Core.Internal
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public static class NormalizedRouteValue
|
public static class NormalizedRouteValue
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.ExceptionServices;
|
using System.Runtime.ExceptionServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Core;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.Mvc.Internal;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Core.Internal
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public abstract class ResourceInvoker
|
public abstract class ResourceInvoker
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Extensions.Primitives;
|
using Microsoft.Extensions.Primitives;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Core.Internal
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public static class ViewEnginePath
|
public static class ViewEnginePath
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
/// <param name="parameter">The <see cref="ParameterDescriptor"/></param>
|
/// <param name="parameter">The <see cref="ParameterDescriptor"/></param>
|
||||||
/// <param name="value">The initial model value.</param>
|
/// <param name="value">The initial model value.</param>
|
||||||
/// <returns>The result of model binding.</returns>
|
/// <returns>The result of model binding.</returns>
|
||||||
public virtual async Task<ModelBindingResult> BindModelAsync(
|
public virtual Task<ModelBindingResult> BindModelAsync(
|
||||||
ActionContext actionContext,
|
ActionContext actionContext,
|
||||||
IValueProvider valueProvider,
|
IValueProvider valueProvider,
|
||||||
ParameterDescriptor parameter,
|
ParameterDescriptor parameter,
|
||||||
|
|
@ -93,13 +93,65 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
}
|
}
|
||||||
|
|
||||||
var metadata = _modelMetadataProvider.GetMetadataForType(parameter.ParameterType);
|
var metadata = _modelMetadataProvider.GetMetadataForType(parameter.ParameterType);
|
||||||
var binder = _modelBinderFactory.CreateBinder(new ModelBinderFactoryContext()
|
var binder = _modelBinderFactory.CreateBinder(new ModelBinderFactoryContext
|
||||||
{
|
{
|
||||||
BindingInfo = parameter.BindingInfo,
|
BindingInfo = parameter.BindingInfo,
|
||||||
Metadata = metadata,
|
Metadata = metadata,
|
||||||
CacheToken = parameter,
|
CacheToken = parameter,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return BindModelAsync(
|
||||||
|
actionContext,
|
||||||
|
binder,
|
||||||
|
valueProvider,
|
||||||
|
parameter,
|
||||||
|
metadata,
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Binds a model specified by <paramref name="parameter"/> using <paramref name="value"/> as the initial value.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="actionContext">The <see cref="ActionContext"/>.</param>
|
||||||
|
/// <param name="modelBinder">The <see cref="IModelBinder"/>.</param>
|
||||||
|
/// <param name="valueProvider">The <see cref="IValueProvider"/>.</param>
|
||||||
|
/// <param name="parameter">The <see cref="ParameterDescriptor"/></param>
|
||||||
|
/// <param name="metadata">The <see cref="ModelMetadata"/>.</param>
|
||||||
|
/// <param name="value">The initial model value.</param>
|
||||||
|
/// <returns>The result of model binding.</returns>
|
||||||
|
public virtual async Task<ModelBindingResult> BindModelAsync(
|
||||||
|
ActionContext actionContext,
|
||||||
|
IModelBinder modelBinder,
|
||||||
|
IValueProvider valueProvider,
|
||||||
|
ParameterDescriptor parameter,
|
||||||
|
ModelMetadata metadata,
|
||||||
|
object value)
|
||||||
|
{
|
||||||
|
if (actionContext == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(actionContext));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modelBinder == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(modelBinder));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (valueProvider == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(valueProvider));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameter == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(parameter));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (metadata == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(metadata));
|
||||||
|
}
|
||||||
|
|
||||||
var modelBindingContext = DefaultModelBindingContext.CreateBindingContext(
|
var modelBindingContext = DefaultModelBindingContext.CreateBindingContext(
|
||||||
actionContext,
|
actionContext,
|
||||||
valueProvider,
|
valueProvider,
|
||||||
|
|
@ -125,7 +177,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
modelBindingContext.ModelName = string.Empty;
|
modelBindingContext.ModelName = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
await binder.BindModelAsync(modelBindingContext);
|
await modelBinder.BindModelAsync(modelBindingContext);
|
||||||
|
|
||||||
var modelBindingResult = modelBindingContext.Result;
|
var modelBindingResult = modelBindingContext.Result;
|
||||||
if (modelBindingResult.IsModelSet)
|
if (modelBindingResult.IsModelSet)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.AspNetCore.Mvc.Core;
|
using Microsoft.AspNetCore.Mvc.Core;
|
||||||
using Microsoft.AspNetCore.Mvc.Core.Internal;
|
using Microsoft.AspNetCore.Mvc.Internal;
|
||||||
using Microsoft.AspNetCore.Mvc.Routing;
|
using Microsoft.AspNetCore.Mvc.Routing;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Text.Encodings.Web;
|
using System.Text.Encodings.Web;
|
||||||
using Microsoft.AspNetCore.Mvc.Core.Internal;
|
using Microsoft.AspNetCore.Mvc.Internal;
|
||||||
using Microsoft.AspNetCore.Mvc.Razor.Internal;
|
using Microsoft.AspNetCore.Mvc.Razor.Internal;
|
||||||
using Microsoft.AspNetCore.Mvc.ViewEngines;
|
using Microsoft.AspNetCore.Mvc.ViewEngines;
|
||||||
using Microsoft.AspNetCore.Razor.Language;
|
using Microsoft.AspNetCore.Razor.Language;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ using System.Reflection;
|
||||||
using System.Runtime.ExceptionServices;
|
using System.Runtime.ExceptionServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Mvc.Abstractions;
|
using Microsoft.AspNetCore.Mvc.Abstractions;
|
||||||
using Microsoft.AspNetCore.Mvc.Core.Internal;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.Mvc.Internal;
|
using Microsoft.AspNetCore.Mvc.Internal;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using System.Threading;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Internal;
|
using Microsoft.AspNetCore.Mvc.Internal;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
using Microsoft.Extensions.Internal;
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
@ -11,20 +13,25 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
|
||||||
{
|
{
|
||||||
public class ViewDataDictionaryControllerPropertyActivator : IControllerPropertyActivator
|
public class ViewDataDictionaryControllerPropertyActivator : IControllerPropertyActivator
|
||||||
{
|
{
|
||||||
private readonly IModelMetadataProvider _modelMetadataProvider;
|
|
||||||
private readonly ConcurrentDictionary<Type, PropertyActivator<ControllerContext>[]> _activateActions;
|
|
||||||
private readonly Func<Type, PropertyActivator<ControllerContext>[]> _getPropertiesToActivate;
|
private readonly Func<Type, PropertyActivator<ControllerContext>[]> _getPropertiesToActivate;
|
||||||
|
private readonly IModelMetadataProvider _modelMetadataProvider;
|
||||||
|
private ConcurrentDictionary<Type, PropertyActivator<ControllerContext>[]> _activateActions;
|
||||||
|
private bool _initialized;
|
||||||
|
private object _initializeLock = new object();
|
||||||
|
|
||||||
public ViewDataDictionaryControllerPropertyActivator(IModelMetadataProvider modelMetadataProvider)
|
public ViewDataDictionaryControllerPropertyActivator(IModelMetadataProvider modelMetadataProvider)
|
||||||
{
|
{
|
||||||
_modelMetadataProvider = modelMetadataProvider;
|
_modelMetadataProvider = modelMetadataProvider;
|
||||||
|
|
||||||
_activateActions = new ConcurrentDictionary<Type, PropertyActivator<ControllerContext>[]>();
|
|
||||||
_getPropertiesToActivate = GetPropertiesToActivate;
|
_getPropertiesToActivate = GetPropertiesToActivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate(ControllerContext actionContext, object controller)
|
public void Activate(ControllerContext actionContext, object controller)
|
||||||
{
|
{
|
||||||
|
LazyInitializer.EnsureInitialized(
|
||||||
|
ref _activateActions,
|
||||||
|
ref _initialized,
|
||||||
|
ref _initializeLock);
|
||||||
|
|
||||||
var controllerType = controller.GetType();
|
var controllerType = controller.GetType();
|
||||||
var propertiesToActivate = _activateActions.GetOrAdd(
|
var propertiesToActivate = _activateActions.GetOrAdd(
|
||||||
controllerType,
|
controllerType,
|
||||||
|
|
@ -37,6 +44,31 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action<ControllerContext, object> GetActivatorDelegate(ControllerActionDescriptor actionDescriptor)
|
||||||
|
{
|
||||||
|
var controllerType = actionDescriptor.ControllerTypeInfo?.AsType();
|
||||||
|
if (controllerType == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException(Resources.FormatPropertyOfTypeCannotBeNull(
|
||||||
|
nameof(actionDescriptor.ControllerTypeInfo),
|
||||||
|
nameof(actionDescriptor)),
|
||||||
|
nameof(actionDescriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
var propertiesToActivate = GetPropertiesToActivate(controllerType);
|
||||||
|
|
||||||
|
void Activate(ControllerContext controllerContext, object controller)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < propertiesToActivate.Length; i++)
|
||||||
|
{
|
||||||
|
var activateInfo = propertiesToActivate[i];
|
||||||
|
activateInfo.Activate(controller, controllerContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Activate;
|
||||||
|
}
|
||||||
|
|
||||||
private PropertyActivator<ControllerContext>[] GetPropertiesToActivate(Type type)
|
private PropertyActivator<ControllerContext>[] GetPropertiesToActivate(Type type)
|
||||||
{
|
{
|
||||||
var activators = PropertyActivator<ControllerContext>.GetPropertiesToActivate(
|
var activators = PropertyActivator<ControllerContext>.GetPropertiesToActivate(
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,157 @@
|
||||||
|
// Copyright (c) .NET Foundation. 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.Reflection;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Internal;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Moq;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
|
{
|
||||||
|
public class ControllerActivatorProviderTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void CreateActivator_InvokesIControllerActivator_IfItIsNotDefaultControllerActivator()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var expected = new object();
|
||||||
|
var activator = new Mock<IControllerActivator>();
|
||||||
|
activator.Setup(a => a.Create(It.IsAny<ControllerContext>()))
|
||||||
|
.Returns(expected)
|
||||||
|
.Verifiable();
|
||||||
|
var activatorProvider = new ControllerActivatorProvider(activator.Object);
|
||||||
|
var descriptor = new ControllerActionDescriptor
|
||||||
|
{
|
||||||
|
ControllerTypeInfo = typeof(object).GetTypeInfo(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var activatorDelegate = activatorProvider.CreateActivator(descriptor);
|
||||||
|
var result = activatorDelegate(new ControllerContext());
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Same(expected, result);
|
||||||
|
activator.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateActivator_ActivatesControllerInstance()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var expected = new TestService();
|
||||||
|
var activator = new DefaultControllerActivator(Mock.Of<ITypeActivatorCache>());
|
||||||
|
var activatorProvider = new ControllerActivatorProvider(activator);
|
||||||
|
var descriptor = new ControllerActionDescriptor
|
||||||
|
{
|
||||||
|
ControllerTypeInfo = typeof(TestController).GetTypeInfo(),
|
||||||
|
};
|
||||||
|
var serviceProvider = new ServiceCollection()
|
||||||
|
.AddSingleton(expected)
|
||||||
|
.BuildServiceProvider();
|
||||||
|
var context = new ControllerContext
|
||||||
|
{
|
||||||
|
HttpContext = new DefaultHttpContext
|
||||||
|
{
|
||||||
|
RequestServices = serviceProvider,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var activatorDelegate = activatorProvider.CreateActivator(descriptor);
|
||||||
|
var result = activatorDelegate(context);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var actual = Assert.IsType<TestController>(result);
|
||||||
|
Assert.Same(expected, actual.TestService);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateReleaser_InvokesIControllerActivator_IfItIsNotDefaultControllerActivator()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var expected = new object();
|
||||||
|
var activator = new Mock<IControllerActivator>();
|
||||||
|
activator.Setup(a => a.Release(It.IsAny<ControllerContext>(), expected))
|
||||||
|
.Verifiable();
|
||||||
|
var activatorProvider = new ControllerActivatorProvider(activator.Object);
|
||||||
|
var descriptor = new ControllerActionDescriptor
|
||||||
|
{
|
||||||
|
ControllerTypeInfo = typeof(object).GetTypeInfo(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var releaseDelegate = activatorProvider.CreateReleaser(descriptor);
|
||||||
|
releaseDelegate(new ControllerContext(), expected);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
activator.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateReleaser_ReturnsNullIfControllerIsNotDisposable()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var activator = new DefaultControllerActivator(Mock.Of<ITypeActivatorCache>());
|
||||||
|
var activatorProvider = new ControllerActivatorProvider(activator);
|
||||||
|
var descriptor = new ControllerActionDescriptor
|
||||||
|
{
|
||||||
|
ControllerTypeInfo = typeof(TestController).GetTypeInfo(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var releaseDelegate = activatorProvider.CreateReleaser(descriptor);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Null(releaseDelegate);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateReleaser_ReturnsDelegateThatDisposesInstance()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var activator = new DefaultControllerActivator(Mock.Of<ITypeActivatorCache>());
|
||||||
|
var activatorProvider = new ControllerActivatorProvider(activator);
|
||||||
|
var descriptor = new ControllerActionDescriptor
|
||||||
|
{
|
||||||
|
ControllerTypeInfo = typeof(DisposableController).GetTypeInfo(),
|
||||||
|
};
|
||||||
|
var controller = new DisposableController();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var releaseDelegate = activatorProvider.CreateReleaser(descriptor);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.NotNull(releaseDelegate);
|
||||||
|
releaseDelegate(new ControllerContext(), controller);
|
||||||
|
Assert.True(controller.Disposed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestController
|
||||||
|
{
|
||||||
|
public TestController(TestService testService)
|
||||||
|
{
|
||||||
|
TestService = testService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestService TestService { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DisposableController : IDisposable
|
||||||
|
{
|
||||||
|
public bool Disposed { get; private set; }
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Disposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestService
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,163 @@
|
||||||
|
// Copyright (c) .NET Foundation. 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.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Internal;
|
||||||
|
using Moq;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
|
{
|
||||||
|
public class ControllerFactoryProviderTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void CreateControllerFactory_InvokesIControllerFactory_IfItIsNotDefaultControllerFactory()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var expected = new object();
|
||||||
|
var factory = new Mock<IControllerFactory>();
|
||||||
|
factory.Setup(f => f.CreateController(It.IsAny<ControllerContext>()))
|
||||||
|
.Returns(expected)
|
||||||
|
.Verifiable();
|
||||||
|
var provider = new ControllerFactoryProvider(
|
||||||
|
Mock.Of<IControllerActivatorProvider>(),
|
||||||
|
factory.Object,
|
||||||
|
Enumerable.Empty<IControllerPropertyActivator>());
|
||||||
|
var descriptor = new ControllerActionDescriptor
|
||||||
|
{
|
||||||
|
ControllerTypeInfo = typeof(object).GetTypeInfo(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var factoryResult = provider.CreateControllerFactory(descriptor);
|
||||||
|
var result = factoryResult(new ControllerContext());
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Same(result, expected);
|
||||||
|
factory.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateControllerReleaser_InvokesIControllerFactory_IfItIsNotDefaultControllerFactory()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var controller = new object();
|
||||||
|
var factory = new Mock<IControllerFactory>();
|
||||||
|
factory.Setup(f => f.ReleaseController(It.IsAny<ControllerContext>(), controller))
|
||||||
|
.Verifiable();
|
||||||
|
var provider = new ControllerFactoryProvider(
|
||||||
|
Mock.Of<IControllerActivatorProvider>(),
|
||||||
|
factory.Object,
|
||||||
|
Enumerable.Empty<IControllerPropertyActivator>());
|
||||||
|
var descriptor = new ControllerActionDescriptor
|
||||||
|
{
|
||||||
|
ControllerTypeInfo = typeof(object).GetTypeInfo(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var releaser = provider.CreateControllerReleaser(descriptor);
|
||||||
|
releaser(new ControllerContext(), controller);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
factory.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateControllerReleaser_UsesControllerActivatorAndPropertyActivator()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var expectedProperty1 = new object();
|
||||||
|
var expectedProperty2 = new object();
|
||||||
|
var expectedController = new TestController();
|
||||||
|
var factory = new DefaultControllerFactory(
|
||||||
|
Mock.Of<IControllerActivator>(),
|
||||||
|
Enumerable.Empty<IControllerPropertyActivator>());
|
||||||
|
var activatorProvider = new Mock<IControllerActivatorProvider>();
|
||||||
|
activatorProvider.Setup(p => p.CreateActivator(It.IsAny<ControllerActionDescriptor>()))
|
||||||
|
.Returns(_ => expectedController)
|
||||||
|
.Verifiable();
|
||||||
|
|
||||||
|
var propertyActivator1 = new Mock<IControllerPropertyActivator>();
|
||||||
|
propertyActivator1.Setup(p => p.GetActivatorDelegate(It.IsAny<ControllerActionDescriptor>()))
|
||||||
|
.Returns((context, controllerObject) =>
|
||||||
|
{
|
||||||
|
((TestController)controllerObject).ActivatedValue1 = expectedProperty1;
|
||||||
|
})
|
||||||
|
.Verifiable();
|
||||||
|
|
||||||
|
var propertyActivator2 = new Mock<IControllerPropertyActivator>();
|
||||||
|
propertyActivator2.Setup(p => p.GetActivatorDelegate(It.IsAny<ControllerActionDescriptor>()))
|
||||||
|
.Returns((context, controllerObject) =>
|
||||||
|
{
|
||||||
|
((TestController)controllerObject).ActivatedValue2 = expectedProperty2;
|
||||||
|
})
|
||||||
|
.Verifiable();
|
||||||
|
|
||||||
|
var propertyActivators = new[]
|
||||||
|
{
|
||||||
|
propertyActivator1.Object,
|
||||||
|
propertyActivator2.Object,
|
||||||
|
};
|
||||||
|
var provider = new ControllerFactoryProvider(
|
||||||
|
activatorProvider.Object,
|
||||||
|
factory,
|
||||||
|
propertyActivators);
|
||||||
|
var descriptor = new ControllerActionDescriptor
|
||||||
|
{
|
||||||
|
ControllerTypeInfo = typeof(TestController).GetTypeInfo(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var factoryDelegate = provider.CreateControllerFactory(descriptor);
|
||||||
|
var controller = factoryDelegate(new ControllerContext());
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var actual = Assert.IsType<TestController>(controller);
|
||||||
|
Assert.Same(expectedController, actual);
|
||||||
|
Assert.Same(expectedProperty1, actual.ActivatedValue1);
|
||||||
|
Assert.Same(expectedProperty2, actual.ActivatedValue2);
|
||||||
|
activatorProvider.Verify();
|
||||||
|
propertyActivator1.Verify();
|
||||||
|
propertyActivator2.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateControllerReleaser_ReturnsReleaser()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var controller = new object();
|
||||||
|
var factory = new DefaultControllerFactory(
|
||||||
|
Mock.Of<IControllerActivator>(),
|
||||||
|
Enumerable.Empty<IControllerPropertyActivator>());
|
||||||
|
Action<ControllerContext, object> expected = (_, __) => { };
|
||||||
|
var activatorProvider = new Mock<IControllerActivatorProvider>();
|
||||||
|
activatorProvider.Setup(p => p.CreateReleaser(It.IsAny<ControllerActionDescriptor>()))
|
||||||
|
.Returns(expected)
|
||||||
|
.Verifiable();
|
||||||
|
var provider = new ControllerFactoryProvider(
|
||||||
|
activatorProvider.Object,
|
||||||
|
factory,
|
||||||
|
Enumerable.Empty<IControllerPropertyActivator>());
|
||||||
|
var descriptor = new ControllerActionDescriptor
|
||||||
|
{
|
||||||
|
ControllerTypeInfo = typeof(object).GetTypeInfo(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var actual = provider.CreateControllerReleaser(descriptor);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Same(expected, actual);
|
||||||
|
activatorProvider.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestController
|
||||||
|
{
|
||||||
|
public object ActivatedValue1 { get; set; }
|
||||||
|
|
||||||
|
public object ActivatedValue2 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Abstractions;
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Internal
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
@ -27,15 +32,15 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
new[] { new DefaultFilterProvider() });
|
new[] { new DefaultFilterProvider() });
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var cacheEntry1 = controllerActionInvokerCache.GetState(controllerContext);
|
var cacheEntry1 = controllerActionInvokerCache.GetCachedResult(controllerContext);
|
||||||
var cacheEntry2 = controllerActionInvokerCache.GetState(controllerContext);
|
var cacheEntry2 = controllerActionInvokerCache.GetCachedResult(controllerContext);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(cacheEntry1.Filters, cacheEntry2.Filters);
|
Assert.Equal(cacheEntry1.filters, cacheEntry2.filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void GetControllerActionMethodExecutor_CachesActionMethodExecutor()
|
public void GetControllerActionMethodExecutor_CachesEntry()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var filter = new TestFilter();
|
var filter = new TestFilter();
|
||||||
|
|
@ -48,11 +53,11 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
new[] { new DefaultFilterProvider() });
|
new[] { new DefaultFilterProvider() });
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var cacheEntry1 = controllerActionInvokerCache.GetState(controllerContext);
|
var cacheEntry1 = controllerActionInvokerCache.GetCachedResult(controllerContext);
|
||||||
var cacheEntry2 = controllerActionInvokerCache.GetState(controllerContext);
|
var cacheEntry2 = controllerActionInvokerCache.GetCachedResult(controllerContext);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Same(cacheEntry1.ActionMethodExecutor, cacheEntry2.ActionMethodExecutor);
|
Assert.Same(cacheEntry1.cacheEntry, cacheEntry2.cacheEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestFilter : IFilterMetadata
|
private class TestFilter : IFilterMetadata
|
||||||
|
|
@ -92,7 +97,19 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
var descriptorProvider = new CustomActionDescriptorCollectionProvider(
|
var descriptorProvider = new CustomActionDescriptorCollectionProvider(
|
||||||
new[] { controllerContext.ActionDescriptor });
|
new[] { controllerContext.ActionDescriptor });
|
||||||
return new ControllerActionInvokerCache(descriptorProvider, filterProviders);
|
var modelMetadataProvider = TestModelMetadataProvider.CreateDefaultProvider();
|
||||||
|
var modelBinderFactory = TestModelBinderFactory.CreateDefault();
|
||||||
|
|
||||||
|
return new ControllerActionInvokerCache(
|
||||||
|
descriptorProvider,
|
||||||
|
new ParameterBinder(
|
||||||
|
modelMetadataProvider,
|
||||||
|
modelBinderFactory,
|
||||||
|
Mock.Of<IObjectModelValidator>()),
|
||||||
|
modelBinderFactory,
|
||||||
|
modelMetadataProvider,
|
||||||
|
filterProviders,
|
||||||
|
Mock.Of<IControllerFactoryProvider>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ControllerContext CreateControllerContext(FilterDescriptor[] filterDescriptors)
|
private static ControllerContext CreateControllerContext(FilterDescriptor[] filterDescriptors)
|
||||||
|
|
@ -101,7 +118,9 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
FilterDescriptors = filterDescriptors,
|
FilterDescriptors = filterDescriptors,
|
||||||
MethodInfo = typeof(TestController).GetMethod(nameof(TestController.Index)),
|
MethodInfo = typeof(TestController).GetMethod(nameof(TestController.Index)),
|
||||||
ControllerTypeInfo = typeof(TestController).GetTypeInfo()
|
ControllerTypeInfo = typeof(TestController).GetTypeInfo(),
|
||||||
|
Parameters = new List<ParameterDescriptor>(),
|
||||||
|
BoundProperties = new List<ParameterDescriptor>(),
|
||||||
};
|
};
|
||||||
|
|
||||||
var actionContext = new ActionContext(new DefaultHttpContext(), new RouteData(), actionDescriptor);
|
var actionContext = new ActionContext(new DefaultHttpContext(), new RouteData(), actionDescriptor);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ using System.Buffers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
@ -630,7 +629,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
// Assert
|
// Assert
|
||||||
challenge.Verify(r => r.ExecuteResultAsync(It.IsAny<ActionContext>()), Times.Once());
|
challenge.Verify(r => r.ExecuteResultAsync(It.IsAny<ActionContext>()), Times.Once());
|
||||||
filter1.Verify(f => f.OnAuthorization(It.IsAny<AuthorizationFilterContext>()), Times.Once());
|
filter1.Verify(f => f.OnAuthorization(It.IsAny<AuthorizationFilterContext>()), Times.Once());
|
||||||
Assert.False(invoker.ControllerFactory.CreateCalled);
|
Assert.False(invoker.ControllerState.CreateCalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -674,7 +673,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
f => f.OnAuthorizationAsync(It.IsAny<AuthorizationFilterContext>()),
|
f => f.OnAuthorizationAsync(It.IsAny<AuthorizationFilterContext>()),
|
||||||
Times.Once());
|
Times.Once());
|
||||||
|
|
||||||
Assert.False(invoker.ControllerFactory.CreateCalled);
|
Assert.False(invoker.ControllerState.CreateCalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -2106,7 +2105,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
expected.Verify(r => r.ExecuteResultAsync(It.IsAny<ActionContext>()), Times.Once());
|
expected.Verify(r => r.ExecuteResultAsync(It.IsAny<ActionContext>()), Times.Once());
|
||||||
Assert.Same(expected.Object, context.Result);
|
Assert.Same(expected.Object, context.Result);
|
||||||
Assert.True(context.Canceled);
|
Assert.True(context.Canceled);
|
||||||
Assert.False(invoker.ControllerFactory.CreateCalled);
|
Assert.False(invoker.ControllerState.CreateCalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -2156,7 +2155,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Null(context.Result);
|
Assert.Null(context.Result);
|
||||||
Assert.True(context.Canceled);
|
Assert.True(context.Canceled);
|
||||||
Assert.False(invoker.ControllerFactory.CreateCalled);
|
Assert.False(invoker.ControllerState.CreateCalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -2209,7 +2208,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
expected.Verify(r => r.ExecuteResultAsync(It.IsAny<ActionContext>()), Times.Once());
|
expected.Verify(r => r.ExecuteResultAsync(It.IsAny<ActionContext>()), Times.Once());
|
||||||
Assert.Same(expected.Object, context.Result);
|
Assert.Same(expected.Object, context.Result);
|
||||||
Assert.True(context.Canceled);
|
Assert.True(context.Canceled);
|
||||||
Assert.False(invoker.ControllerFactory.CreateCalled);
|
Assert.False(invoker.ControllerState.CreateCalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -2272,7 +2271,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
f => f.OnResourceExecutionAsync(It.IsAny<ResourceExecutingContext>(), It.IsAny<ResourceExecutionDelegate>()),
|
f => f.OnResourceExecutionAsync(It.IsAny<ResourceExecutingContext>(), It.IsAny<ResourceExecutionDelegate>()),
|
||||||
Times.Never());
|
Times.Never());
|
||||||
|
|
||||||
Assert.False(invoker.ControllerFactory.CreateCalled);
|
Assert.False(invoker.ControllerState.CreateCalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -2298,7 +2297,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
await invoker.InvokeAsync();
|
await invoker.InvokeAsync();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var controllerContext = invoker.ControllerFactory.ControllerContext;
|
var controllerContext = invoker.ControllerState.ControllerContext;
|
||||||
Assert.NotNull(controllerContext);
|
Assert.NotNull(controllerContext);
|
||||||
Assert.Equal(2, controllerContext.ValueProviderFactories.Count);
|
Assert.Equal(2, controllerContext.ValueProviderFactories.Count);
|
||||||
Assert.Same(valueProviderFactory1, controllerContext.ValueProviderFactories[0]);
|
Assert.Same(valueProviderFactory1, controllerContext.ValueProviderFactories[0]);
|
||||||
|
|
@ -2329,7 +2328,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
await invoker.InvokeAsync();
|
await invoker.InvokeAsync();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var controllerContext = invoker.ControllerFactory.ControllerContext;
|
var controllerContext = invoker.ControllerState.ControllerContext;
|
||||||
Assert.NotNull(controllerContext);
|
Assert.NotNull(controllerContext);
|
||||||
Assert.Equal(1, controllerContext.ValueProviderFactories.Count);
|
Assert.Equal(1, controllerContext.ValueProviderFactories.Count);
|
||||||
Assert.Same(valueProviderFactory2, controllerContext.ValueProviderFactories[0]);
|
Assert.Same(valueProviderFactory2, controllerContext.ValueProviderFactories[0]);
|
||||||
|
|
@ -2910,35 +2909,29 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
||||||
var actionContext = new ActionContext(context.Object, new RouteData(), actionDescriptor);
|
var actionContext = new ActionContext(context.Object, new RouteData(), actionDescriptor);
|
||||||
|
|
||||||
var controllerFactory = new Mock<IControllerFactory>();
|
|
||||||
controllerFactory.Setup(c => c.CreateController(It.IsAny<ControllerContext>()))
|
|
||||||
.Returns(new TestController());
|
|
||||||
|
|
||||||
var metadataProvider = new EmptyModelMetadataProvider();
|
|
||||||
|
|
||||||
var parameterBinder = new ParameterBinder(
|
|
||||||
metadataProvider,
|
|
||||||
TestModelBinderFactory.CreateDefault(metadataProvider),
|
|
||||||
new DefaultObjectValidator(metadataProvider, new IModelValidatorProvider[0]));
|
|
||||||
|
|
||||||
var controllerContext = new ControllerContext(actionContext)
|
var controllerContext = new ControllerContext(actionContext)
|
||||||
{
|
{
|
||||||
ValueProviderFactories = new IValueProviderFactory[0]
|
ValueProviderFactories = new IValueProviderFactory[0]
|
||||||
};
|
};
|
||||||
controllerContext.ModelState.MaxAllowedErrors = 200;
|
controllerContext.ModelState.MaxAllowedErrors = 200;
|
||||||
|
var objectMethodExecutor = ObjectMethodExecutor.Create(
|
||||||
|
actionDescriptor.MethodInfo,
|
||||||
|
actionDescriptor.ControllerTypeInfo,
|
||||||
|
ParameterDefaultValues.GetParameterDefaultValues(actionDescriptor.MethodInfo));
|
||||||
|
|
||||||
|
var cacheEntry = new ControllerActionInvokerCacheEntry(
|
||||||
|
new FilterItem[0],
|
||||||
|
_ => new TestController(),
|
||||||
|
(_, __) => { },
|
||||||
|
(_, __, ___) => Task.CompletedTask,
|
||||||
|
actionMethodExecutor: objectMethodExecutor);
|
||||||
|
|
||||||
var invoker = new ControllerActionInvoker(
|
var invoker = new ControllerActionInvoker(
|
||||||
controllerFactory.Object,
|
|
||||||
parameterBinder,
|
|
||||||
metadataProvider,
|
|
||||||
new NullLoggerFactory().CreateLogger<ControllerActionInvoker>(),
|
new NullLoggerFactory().CreateLogger<ControllerActionInvoker>(),
|
||||||
new DiagnosticListener("Microsoft.AspNetCore"),
|
new DiagnosticListener("Microsoft.AspNetCore"),
|
||||||
controllerContext,
|
controllerContext,
|
||||||
new IFilterMetadata[0],
|
cacheEntry,
|
||||||
ObjectMethodExecutor.Create(
|
new IFilterMetadata[0]);
|
||||||
actionDescriptor.MethodInfo,
|
|
||||||
actionDescriptor.ControllerTypeInfo,
|
|
||||||
ParameterDefaultValues.GetParameterDefaultValues(actionDescriptor.MethodInfo)));
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await invoker.InvokeAsync();
|
await invoker.InvokeAsync();
|
||||||
|
|
@ -2972,7 +2965,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var invoker = CreateInvoker(
|
var invoker = CreateInvoker(
|
||||||
new[] { filter },
|
new[] { filter },
|
||||||
actionDescriptor,
|
actionDescriptor,
|
||||||
parameterBinder: null,
|
|
||||||
controller: null,
|
controller: null,
|
||||||
logger: logger);
|
logger: logger);
|
||||||
|
|
||||||
|
|
@ -3015,7 +3007,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var invoker = CreateInvoker(
|
var invoker = CreateInvoker(
|
||||||
new[] { filter },
|
new[] { filter },
|
||||||
actionDescriptor,
|
actionDescriptor,
|
||||||
parameterBinder: null,
|
|
||||||
controller: null,
|
controller: null,
|
||||||
diagnosticListener: listener,
|
diagnosticListener: listener,
|
||||||
routeData: routeData);
|
routeData: routeData);
|
||||||
|
|
@ -3055,7 +3046,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var invoker = CreateInvoker(
|
var invoker = CreateInvoker(
|
||||||
new[] { filter },
|
new[] { filter },
|
||||||
actionDescriptor,
|
actionDescriptor,
|
||||||
parameterBinder: null,
|
|
||||||
controller: null,
|
controller: null,
|
||||||
diagnosticListener: listener);
|
diagnosticListener: listener);
|
||||||
|
|
||||||
|
|
@ -3145,8 +3135,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
actionDescriptor.ControllerTypeInfo = typeof(ControllerActionInvokerTest).GetTypeInfo();
|
actionDescriptor.ControllerTypeInfo = typeof(ControllerActionInvokerTest).GetTypeInfo();
|
||||||
|
|
||||||
return CreateInvoker(
|
return CreateInvoker(filters, actionDescriptor, null, maxAllowedErrorsInModelState, valueProviderFactories);
|
||||||
filters, actionDescriptor, null, null, maxAllowedErrorsInModelState, valueProviderFactories);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TestControllerActionInvoker CreateInvoker(
|
private TestControllerActionInvoker CreateInvoker(
|
||||||
|
|
@ -3173,18 +3162,17 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var parameterBinder = new TestParameterBinder(arguments);
|
var testControllerState = new TestControllerState(actionDescriptor, _controller, arguments);
|
||||||
|
return CreateInvoker(filters, actionDescriptor, _controller, maxAllowedErrorsInModelState, testControllerState: testControllerState);
|
||||||
return CreateInvoker(filters, actionDescriptor, _controller, parameterBinder, maxAllowedErrorsInModelState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TestControllerActionInvoker CreateInvoker(
|
private TestControllerActionInvoker CreateInvoker(
|
||||||
IFilterMetadata[] filters,
|
IFilterMetadata[] filters,
|
||||||
ControllerActionDescriptor actionDescriptor,
|
ControllerActionDescriptor actionDescriptor,
|
||||||
object controller,
|
object controller,
|
||||||
ParameterBinder parameterBinder = null,
|
|
||||||
int maxAllowedErrorsInModelState = 200,
|
int maxAllowedErrorsInModelState = 200,
|
||||||
List<IValueProviderFactory> valueProviderFactories = null,
|
List<IValueProviderFactory> valueProviderFactories = null,
|
||||||
|
TestControllerState testControllerState = null,
|
||||||
RouteData routeData = null,
|
RouteData routeData = null,
|
||||||
ILogger logger = null,
|
ILogger logger = null,
|
||||||
object diagnosticListener = null)
|
object diagnosticListener = null)
|
||||||
|
|
@ -3222,6 +3210,11 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
||||||
options.OutputFormatters.Add(formatter.Object);
|
options.OutputFormatters.Add(formatter.Object);
|
||||||
|
|
||||||
|
if (testControllerState == null)
|
||||||
|
{
|
||||||
|
testControllerState = new TestControllerState(actionDescriptor, controller ?? this);
|
||||||
|
}
|
||||||
|
|
||||||
if (routeData == null)
|
if (routeData == null)
|
||||||
{
|
{
|
||||||
routeData = new RouteData();
|
routeData = new RouteData();
|
||||||
|
|
@ -3232,11 +3225,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
routeData: routeData,
|
routeData: routeData,
|
||||||
actionDescriptor: actionDescriptor);
|
actionDescriptor: actionDescriptor);
|
||||||
|
|
||||||
if (parameterBinder == null)
|
|
||||||
{
|
|
||||||
parameterBinder = new TestParameterBinder(new Dictionary<string, object>());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valueProviderFactories == null)
|
if (valueProviderFactories == null)
|
||||||
{
|
{
|
||||||
valueProviderFactories = new List<IValueProviderFactory>();
|
valueProviderFactories = new List<IValueProviderFactory>();
|
||||||
|
|
@ -3255,9 +3243,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
||||||
var invoker = new TestControllerActionInvoker(
|
var invoker = new TestControllerActionInvoker(
|
||||||
filters,
|
filters,
|
||||||
new MockControllerFactory(controller ?? this),
|
testControllerState,
|
||||||
parameterBinder,
|
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
|
||||||
logger,
|
logger,
|
||||||
diagnosticSource,
|
diagnosticSource,
|
||||||
actionContext,
|
actionContext,
|
||||||
|
|
@ -3443,13 +3429,45 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MockControllerFactory : IControllerFactory
|
private class TestControllerState
|
||||||
{
|
{
|
||||||
private object _controller;
|
private readonly ControllerActionDescriptor _descriptor;
|
||||||
|
private readonly object _controller;
|
||||||
|
|
||||||
public MockControllerFactory(object controller)
|
public TestControllerState(
|
||||||
|
ControllerActionDescriptor descriptor,
|
||||||
|
object controller)
|
||||||
|
: this(descriptor, controller, new Dictionary<string, object>())
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestControllerState(
|
||||||
|
ControllerActionDescriptor descriptor,
|
||||||
|
object controller,
|
||||||
|
IDictionary<string, object> actionArguments)
|
||||||
|
{
|
||||||
|
_descriptor = descriptor;
|
||||||
_controller = controller;
|
_controller = controller;
|
||||||
|
|
||||||
|
var objectMethodExecutor = ObjectMethodExecutor.Create(
|
||||||
|
_descriptor.MethodInfo,
|
||||||
|
_descriptor.ControllerTypeInfo,
|
||||||
|
ParameterDefaultValues.GetParameterDefaultValues(_descriptor.MethodInfo));
|
||||||
|
|
||||||
|
CacheEntry = new ControllerActionInvokerCacheEntry(
|
||||||
|
new FilterItem[0],
|
||||||
|
CreateController,
|
||||||
|
ReleaseController,
|
||||||
|
(_, __, args) =>
|
||||||
|
{
|
||||||
|
foreach (var item in actionArguments)
|
||||||
|
{
|
||||||
|
args[item.Key] = item.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
},
|
||||||
|
objectMethodExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateCalled { get; private set; }
|
public bool CreateCalled { get; private set; }
|
||||||
|
|
@ -3458,6 +3476,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
||||||
public ControllerContext ControllerContext { get; private set; }
|
public ControllerContext ControllerContext { get; private set; }
|
||||||
|
|
||||||
|
public ControllerActionInvokerCacheEntry CacheEntry { get; }
|
||||||
|
|
||||||
public object CreateController(ControllerContext context)
|
public object CreateController(ControllerContext context)
|
||||||
{
|
{
|
||||||
ControllerContext = context;
|
ControllerContext = context;
|
||||||
|
|
@ -3485,43 +3505,30 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public TestControllerActionInvoker(
|
public TestControllerActionInvoker(
|
||||||
IFilterMetadata[] filters,
|
IFilterMetadata[] filters,
|
||||||
MockControllerFactory controllerFactory,
|
TestControllerState testControllerState,
|
||||||
ParameterBinder parameterBinder,
|
|
||||||
IModelMetadataProvider modelMetadataProvider,
|
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
DiagnosticSource diagnosticSource,
|
DiagnosticSource diagnosticSource,
|
||||||
ActionContext actionContext,
|
ActionContext actionContext,
|
||||||
IReadOnlyList<IValueProviderFactory> valueProviderFactories,
|
IReadOnlyList<IValueProviderFactory> valueProviderFactories,
|
||||||
int maxAllowedErrorsInModelState)
|
int maxAllowedErrorsInModelState)
|
||||||
: base(
|
: base(
|
||||||
controllerFactory,
|
|
||||||
parameterBinder,
|
|
||||||
modelMetadataProvider,
|
|
||||||
logger,
|
logger,
|
||||||
diagnosticSource,
|
diagnosticSource,
|
||||||
CreatControllerContext(actionContext, valueProviderFactories, maxAllowedErrorsInModelState),
|
CreatControllerContext(actionContext, valueProviderFactories, maxAllowedErrorsInModelState),
|
||||||
filters,
|
testControllerState.CacheEntry,
|
||||||
CreateExecutor((ControllerActionDescriptor)actionContext.ActionDescriptor))
|
filters)
|
||||||
{
|
{
|
||||||
ControllerFactory = controllerFactory;
|
ControllerState = testControllerState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MockControllerFactory ControllerFactory { get; }
|
public TestControllerState ControllerState { get; }
|
||||||
|
|
||||||
public async override Task InvokeAsync()
|
public async override Task InvokeAsync()
|
||||||
{
|
{
|
||||||
await base.InvokeAsync();
|
await base.InvokeAsync();
|
||||||
|
|
||||||
// Make sure that the controller was disposed in every test that creates ones.
|
// Make sure that the controller was disposed in every test that creates ones.
|
||||||
ControllerFactory.Verify();
|
ControllerState.Verify();
|
||||||
}
|
|
||||||
|
|
||||||
private static ObjectMethodExecutor CreateExecutor(ControllerActionDescriptor actionDescriptor)
|
|
||||||
{
|
|
||||||
return ObjectMethodExecutor.Create(
|
|
||||||
actionDescriptor.MethodInfo,
|
|
||||||
actionDescriptor.ControllerTypeInfo,
|
|
||||||
ParameterDefaultValues.GetParameterDefaultValues(actionDescriptor.MethodInfo));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ControllerContext CreatControllerContext(
|
private static ControllerContext CreatControllerContext(
|
||||||
|
|
@ -3539,6 +3546,14 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ObjectMethodExecutor CreateExecutor(ControllerActionDescriptor actionDescriptor)
|
||||||
|
{
|
||||||
|
return ObjectMethodExecutor.Create(
|
||||||
|
actionDescriptor.MethodInfo,
|
||||||
|
actionDescriptor.ControllerTypeInfo,
|
||||||
|
ParameterDefaultValues.GetParameterDefaultValues(actionDescriptor.MethodInfo));
|
||||||
|
}
|
||||||
|
|
||||||
private class MockAuthorizationFilter : IAuthorizationFilter
|
private class MockAuthorizationFilter : IAuthorizationFilter
|
||||||
{
|
{
|
||||||
int _expectedMaxAllowedErrors;
|
int _expectedMaxAllowedErrors;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc.Abstractions;
|
using Microsoft.AspNetCore.Mvc.Abstractions;
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
|
@ -17,7 +19,7 @@ using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Internal
|
namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public class ControllerActionInvokerParameterBindingTest
|
public class ControllerBinderDelegateProviderTest
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task BindActionArgumentsAsync_DoesNotAddActionArguments_IfBinderReturnsNull()
|
public async Task BindActionArgumentsAsync_DoesNotAddActionArguments_IfBinderReturnsNull()
|
||||||
|
|
@ -44,12 +46,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var arguments = new Dictionary<string, object>(StringComparer.Ordinal);
|
var arguments = new Dictionary<string, object>(StringComparer.Ordinal);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Empty(arguments);
|
Assert.Empty(arguments);
|
||||||
|
|
@ -80,12 +83,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var arguments = new Dictionary<string, object>(StringComparer.Ordinal);
|
var arguments = new Dictionary<string, object>(StringComparer.Ordinal);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Empty(arguments);
|
Assert.Empty(arguments);
|
||||||
|
|
@ -125,12 +129,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var arguments = new Dictionary<string, object>(StringComparer.Ordinal);
|
var arguments = new Dictionary<string, object>(StringComparer.Ordinal);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(1, arguments.Count);
|
Assert.Equal(1, arguments.Count);
|
||||||
|
|
@ -166,12 +171,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var arguments = new Dictionary<string, object>(StringComparer.Ordinal);
|
var arguments = new Dictionary<string, object>(StringComparer.Ordinal);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
mockValidator
|
mockValidator
|
||||||
|
|
@ -218,12 +224,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var parameterBinder = GetParameterBinder(factory, mockValidator.Object);
|
var parameterBinder = GetParameterBinder(factory, mockValidator.Object);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
mockValidator
|
mockValidator
|
||||||
|
|
@ -263,12 +270,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var parameterBinder = GetParameterBinder(factory, mockValidator.Object);
|
var parameterBinder = GetParameterBinder(factory, mockValidator.Object);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
mockValidator
|
mockValidator
|
||||||
|
|
@ -314,12 +322,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var parameterBinder = GetParameterBinder(factory, mockValidator.Object);
|
var parameterBinder = GetParameterBinder(factory, mockValidator.Object);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
mockValidator
|
mockValidator
|
||||||
|
|
@ -353,12 +362,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal("Hello", controller.StringProperty);
|
Assert.Equal("Hello", controller.StringProperty);
|
||||||
|
|
@ -388,12 +398,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var parameterBinder = GetParameterBinder(factory);
|
var parameterBinder = GetParameterBinder(factory);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, controller.CollectionProperty);
|
Assert.Equal(expected, controller.CollectionProperty);
|
||||||
|
|
@ -429,12 +440,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
controller.NonNullableProperty = -1;
|
controller.NonNullableProperty = -1;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(-1, controller.NonNullableProperty);
|
Assert.Equal(-1, controller.NonNullableProperty);
|
||||||
|
|
@ -466,12 +478,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
controller.NullableProperty = -1;
|
controller.NullableProperty = -1;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Null(controller.NullableProperty);
|
Assert.Null(controller.NullableProperty);
|
||||||
|
|
@ -543,12 +556,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var parameterBinder = GetParameterBinder(factory);
|
var parameterBinder = GetParameterBinder(factory);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expectedValue, propertyAccessor(controller));
|
Assert.Equal(expectedValue, propertyAccessor(controller));
|
||||||
|
|
@ -622,12 +636,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var parameterBinder = GetParameterBinder(factory);
|
var parameterBinder = GetParameterBinder(factory);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder,
|
parameterBinder,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
controllerContext,
|
actionDescriptor);
|
||||||
controller,
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, controller, arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(new string[] { "goodbye" }, controller.ArrayProperty); // Skipped
|
Assert.Equal(new string[] { "goodbye" }, controller.ArrayProperty); // Skipped
|
||||||
|
|
@ -708,17 +723,20 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
Parameters = parameters
|
Parameters = parameters
|
||||||
};
|
};
|
||||||
var modelMetadataProvider = new EmptyModelMetadataProvider();
|
var modelMetadataProvider = new EmptyModelMetadataProvider();
|
||||||
|
var modelBinderProvider = new BodyModelBinderProvider(new[] { Mock.Of<IInputFormatter>() }, Mock.Of<IHttpRequestStreamReaderFactory>());
|
||||||
|
var factory = TestModelBinderFactory.CreateDefault(modelBinderProvider);
|
||||||
var parameterBinder = new Mock<ParameterBinder>(
|
var parameterBinder = new Mock<ParameterBinder>(
|
||||||
new EmptyModelMetadataProvider(),
|
new EmptyModelMetadataProvider(),
|
||||||
TestModelBinderFactory.CreateDefault(),
|
factory,
|
||||||
CreateMockValidator());
|
CreateMockValidator());
|
||||||
parameterBinder.Setup(p => p.BindModelAsync(
|
parameterBinder.Setup(p => p.BindModelAsync(
|
||||||
It.IsAny<ActionContext>(),
|
It.IsAny<ActionContext>(),
|
||||||
|
It.IsAny<IModelBinder>(),
|
||||||
It.IsAny<IValueProvider>(),
|
It.IsAny<IValueProvider>(),
|
||||||
It.IsAny<ParameterDescriptor>(),
|
It.IsAny<ParameterDescriptor>(),
|
||||||
|
It.IsAny<ModelMetadata>(),
|
||||||
null))
|
null))
|
||||||
.Returns((ActionContext context, IValueProvider valueProvider, ParameterDescriptor descriptor, object v) =>
|
.Returns((ActionContext context, IModelBinder modelBinder, IValueProvider valueProvider, ParameterDescriptor descriptor, ModelMetadata metadata, object v) =>
|
||||||
{
|
{
|
||||||
ModelBindingResult result;
|
ModelBindingResult result;
|
||||||
if (descriptor.Name == "accountId")
|
if (descriptor.Name == "accountId")
|
||||||
|
|
@ -741,26 +759,26 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
return Task.FromResult(result);
|
return Task.FromResult(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
var testContext = new ControllerContext
|
var controllerContext = new ControllerContext
|
||||||
{
|
{
|
||||||
ActionDescriptor = actionDescriptor,
|
ActionDescriptor = actionDescriptor,
|
||||||
};
|
};
|
||||||
|
|
||||||
var arguments = new Dictionary<string, object>(StringComparer.Ordinal);
|
var arguments = new Dictionary<string, object>(StringComparer.Ordinal);
|
||||||
var modelState = testContext.ModelState;
|
var modelState = controllerContext.ModelState;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await ControllerActionInvoker.BindArgumentsCoreAsync(
|
var binderDelegate = ControllerBinderDelegateProvider.CreateBinderDelegate(
|
||||||
parameterBinder.Object,
|
parameterBinder.Object,
|
||||||
|
factory,
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
TestModelMetadataProvider.CreateDefaultProvider(),
|
||||||
testContext,
|
actionDescriptor);
|
||||||
new TestController(),
|
|
||||||
arguments);
|
await binderDelegate(controllerContext, new TestController(), arguments);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.True(modelState.IsValid);
|
Assert.True(modelState.IsValid);
|
||||||
object value;
|
Assert.True(arguments.TryGetValue("accountId", out var value));
|
||||||
Assert.True(arguments.TryGetValue("accountId", out value));
|
|
||||||
var accountId = Assert.IsType<int>(value);
|
var accountId = Assert.IsType<int>(value);
|
||||||
Assert.Equal(10, accountId);
|
Assert.Equal(10, accountId);
|
||||||
Assert.True(arguments.TryGetValue("transferInfo", out value));
|
Assert.True(arguments.TryGetValue("transferInfo", out value));
|
||||||
|
|
@ -14,7 +14,6 @@ using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc.Abstractions;
|
using Microsoft.AspNetCore.Mvc.Abstractions;
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
|
|
@ -284,8 +283,6 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var invoker = new TestControllerActionInvoker(
|
var invoker = new TestControllerActionInvoker(
|
||||||
filters,
|
filters,
|
||||||
new MockControllerFactory(controller ?? this),
|
new MockControllerFactory(controller ?? this),
|
||||||
new TestParameterBinder(actionParameters: null),
|
|
||||||
TestModelMetadataProvider.CreateDefaultProvider(),
|
|
||||||
new NullLoggerFactory().CreateLogger<ControllerActionInvoker>(),
|
new NullLoggerFactory().CreateLogger<ControllerActionInvoker>(),
|
||||||
diagnosticSource,
|
diagnosticSource,
|
||||||
actionContext,
|
actionContext,
|
||||||
|
|
@ -342,7 +339,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MockControllerFactory : IControllerFactory
|
private class MockControllerFactory
|
||||||
{
|
{
|
||||||
private object _controller;
|
private object _controller;
|
||||||
|
|
||||||
|
|
@ -380,37 +377,22 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ControllerActionInvokerCache CreateFilterCache(IFilterProvider[] filterProviders = null)
|
|
||||||
{
|
|
||||||
var descriptorProvider = new ActionDescriptorCollectionProvider(
|
|
||||||
Enumerable.Empty<IActionDescriptorProvider>(),
|
|
||||||
Enumerable.Empty<IActionDescriptorChangeProvider>());
|
|
||||||
return new ControllerActionInvokerCache(
|
|
||||||
descriptorProvider,
|
|
||||||
filterProviders.AsEnumerable() ?? new List<IFilterProvider>());
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TestControllerActionInvoker : ControllerActionInvoker
|
private class TestControllerActionInvoker : ControllerActionInvoker
|
||||||
{
|
{
|
||||||
public TestControllerActionInvoker(
|
public TestControllerActionInvoker(
|
||||||
IFilterMetadata[] filters,
|
IFilterMetadata[] filters,
|
||||||
MockControllerFactory controllerFactory,
|
MockControllerFactory controllerFactory,
|
||||||
ParameterBinder parameterBinder,
|
|
||||||
IModelMetadataProvider modelMetadataProvider,
|
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
DiagnosticSource diagnosticSource,
|
DiagnosticSource diagnosticSource,
|
||||||
ActionContext actionContext,
|
ActionContext actionContext,
|
||||||
IReadOnlyList<IValueProviderFactory> valueProviderFactories,
|
IReadOnlyList<IValueProviderFactory> valueProviderFactories,
|
||||||
int maxAllowedErrorsInModelState)
|
int maxAllowedErrorsInModelState)
|
||||||
: base(
|
: base(
|
||||||
controllerFactory,
|
|
||||||
parameterBinder,
|
|
||||||
modelMetadataProvider,
|
|
||||||
logger,
|
logger,
|
||||||
diagnosticSource,
|
diagnosticSource,
|
||||||
CreatControllerContext(actionContext, valueProviderFactories, maxAllowedErrorsInModelState),
|
CreatControllerContext(actionContext, valueProviderFactories, maxAllowedErrorsInModelState),
|
||||||
filters,
|
CreateCacheEntry((ControllerActionDescriptor)actionContext.ActionDescriptor, controllerFactory),
|
||||||
CreateExecutor((ControllerActionDescriptor)actionContext.ActionDescriptor))
|
filters)
|
||||||
{
|
{
|
||||||
ControllerFactory = controllerFactory;
|
ControllerFactory = controllerFactory;
|
||||||
}
|
}
|
||||||
|
|
@ -443,6 +425,18 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
||||||
return controllerContext;
|
return controllerContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ControllerActionInvokerCacheEntry CreateCacheEntry(
|
||||||
|
ControllerActionDescriptor actionDescriptor,
|
||||||
|
MockControllerFactory controllerFactory)
|
||||||
|
{
|
||||||
|
return new ControllerActionInvokerCacheEntry(
|
||||||
|
new FilterItem[0],
|
||||||
|
controllerFactory.CreateController,
|
||||||
|
controllerFactory.ReleaseController,
|
||||||
|
null,
|
||||||
|
CreateExecutor(actionDescriptor));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestParameterBinder : ParameterBinder
|
private class TestParameterBinder : ParameterBinder
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,227 @@
|
||||||
|
TpTrace Information: 0 : 7340, 2, 2017/05/12, 14:46:19.552, 2296211289945, testhost.dll, DefaultEngineInvoker: Monitoring parent process with id: '17636'
|
||||||
|
TpTrace Information: 0 : 7340, 2, 2017/05/12, 14:46:19.582, 2296211362311, testhost.dll, DefaultEngineInvoker: Initialize communication on port number: '64746'
|
||||||
|
TpTrace Information: 0 : 7340, 2, 2017/05/12, 14:46:19.589, 2296211382526, testhost.dll, Trying to connect to server on port : 64746
|
||||||
|
TpTrace Information: 0 : 7340, 6, 2017/05/12, 14:46:19.619, 2296211471935, testhost.dll, Connected to the server successfully
|
||||||
|
TpTrace Information: 0 : 7340, 2, 2017/05/12, 14:46:19.770, 2296211912888, testhost.dll, DefaultEngineInvoker: Start Request Processing.
|
||||||
|
TpTrace Information: 0 : 7340, 5, 2017/05/12, 14:46:19.786, 2296211961678, testhost.dll, Discovery Session Initialize.
|
||||||
|
TpTrace Information: 0 : 7340, 5, 2017/05/12, 14:46:19.791, 2296211974612, testhost.dll, Execution started.
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.800, 2296212001963, testhost.dll, TestPluginCache: Updating loadOnlyWellKnownExtensions from False to False.
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.803, 2296212012328, testhost.dll, TestPluginCache: Using directories for assembly resolution 'D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\bin\Debug\netcoreapp2.0'.
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.804, 2296212013228, testhost.dll, TestPluginCache: Updated the available extensions to 'D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\bin\Debug\netcoreapp2.0\xunit.runner.visualstudio.dotnetcore.testadapter.dll'.
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.806, 2296212018539, testhost.dll, TestExecutorService: Loading the extensions
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.824, 2296212071700, testhost.dll, TestPluginCache: Discovering the extensions using extension path.
|
||||||
|
TpTrace Error: 0 : 7340, 8, 2017/05/12, 14:46:19.825, 2296212074849, testhost.dll, Default extensions folder does not exist
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:19.834, 2296212101249, testhost.dll, AssemblyResolver: xunit.runner.visualstudio.dotnetcore.testadapter: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:19.836, 2296212108511, testhost.dll, AssemblyResolver: xunit.runner.visualstudio.dotnetcore.testadapter: Resolved assembly.
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:19.838, 2296212114315, testhost.dll, AssemblyResolver: xunit.runner.utility.netstandard15: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:19.839, 2296212117237, testhost.dll, AssemblyResolver: xunit.runner.utility.netstandard15: Resolved assembly.
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.849, 2296212144749, testhost.dll, TestPluginCache: Discovered the extensions using extension path 'D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\bin\Debug\netcoreapp2.0\xunit.runner.visualstudio.dotnetcore.testadapter.dll'.
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.851, 2296212152310, testhost.dll, TestPluginCache: Discoverers are 'Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner, xunit.runner.visualstudio.dotnetcore.testadapter, Version=2.2.0.1274, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c'.
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.851, 2296212152804, testhost.dll, TestPluginCache: Executors are 'executor://xunit/VsTestRunner2'.
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.852, 2296212153071, testhost.dll, TestPluginCache: Setting providers are ''.
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.852, 2296212153245, testhost.dll, TestPluginCache: Loggers are ''.
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:19.863, 2296212185977, testhost.dll, TestPluginManager.CreateTestExtension: Attempting to load test extension: Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.863, 2296212186881, testhost.dll, TestDiscoveryManager: LoadExtensions: Created discoverer Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.863, 2296212187141, testhost.dll, TestExecutorService: Loaded the discoverers
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:19.873, 2296212215633, testhost.dll, TestPluginManager.CreateTestExtension: Attempting to load test extension: Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.873, 2296212216190, testhost.dll, TestExecutorExtensionManager: Loading executor Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.873, 2296212216371, testhost.dll, TestExecutorService: Loaded the executors
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.878, 2296212230115, testhost.dll, TestExecutorService: Loaded the settings providers
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:19.878, 2296212230432, testhost.dll, TestExecutorService: Loaded the extensions
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:19.911, 2296212325983, testhost.dll, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.Common.resources: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:19.912, 2296212329124, testhost.dll, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.Common.resources: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:19.938, 2296212406954, testhost.dll, TestDiscoveryManager: Discovering tests from sources D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\bin\Debug\netcoreapp2.0\Microsoft.AspNetCore.Mvc.Core.Test.dll
|
||||||
|
TpTrace Verbose: 0 : 7340, 8, 2017/05/12, 14:46:19.948, 2296212435838, testhost.dll, BaseRunTests.RunTestInternalWithExecutors: Running tests for executor://xunit/VsTestRunner2
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:21.567, 2296217179825, testhost.dll, AssemblyResolver: xunit.runner.reporters.netstandard15: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:21.568, 2296217181466, testhost.dll, AssemblyResolver: xunit.runner.reporters.netstandard15: Resolved assembly.
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:21.569, 2296217185540, testhost.dll, AssemblyResolver: xunit.runner.utility.netstandard15: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:21.569, 2296217185750, testhost.dll, AssemblyResolver: xunit.runner.utility.netstandard15: Resolved from cache.
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:21.688, 2296217531986, testhost.dll, [xUnit.net 00:00:01.7330337] Discovering: Microsoft.AspNetCore.Mvc.Core.Test
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:24.892, 2296226920961, testhost.dll, [xUnit.net 00:00:04.9399399] Discovered: Microsoft.AspNetCore.Mvc.Core.Test
|
||||||
|
TpTrace Information: 0 : 7340, 8, 2017/05/12, 14:46:26.011, 2296230196922, testhost.dll, [xUnit.net 00:00:06.0581478] Starting: Microsoft.AspNetCore.Mvc.Core.Test
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.133, 2296230555033, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.169, 2296230660092, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.235, 2296230853307, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.261, 2296230930194, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.261, 2296230930969, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.267, 2296230948461, testhost.dll, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.ObjectModel.resources: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.268, 2296230950524, testhost.dll, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.ObjectModel.resources: Resolving assembly.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.269, 2296230954276, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.Constructor_InitializesActionName(actionName: null) Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.269, 2296230955003, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.269, 2296230955651, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.DefaultModelMetadataBindingDetailsProviderTest.CreateBindingDetails_BindingBehaviorLeftAlone_ForAttributeOnPropertyType(initialValue: False) Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.270, 2296230956600, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.DefaultFilterProviderTest.DefaultFilterProvider_UsesFilter_WhenItsNotIFilterFactory Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.270, 2296230958000, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.297, 2296231035076, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.297, 2296231036058, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.297, 2296231036327, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.DefaultModelMetadataBindingDetailsProviderTest.CreateBindingDetails_FindsBindNever_OnContainerClass Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.297, 2296231036648, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.297, 2296231037278, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.298, 2296231037803, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.298, 2296231038351, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.298, 2296231038850, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.298, 2296231039367, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.298, 2296231039898, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.298, 2296231040407, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.299, 2296231040941, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.299, 2296231041249, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.317, 2296231093622, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.317, 2296231094370, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.317, 2296231094684, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.DefaultModelMetadataBindingDetailsProviderTest.CreateBindingDetails_FindsBindNever_OnProperty Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.317, 2296231094970, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.317, 2296231095534, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.317, 2296231096109, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.318, 2296231096590, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.318, 2296231097119, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.318, 2296231097674, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.318, 2296231098292, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.318, 2296231098860, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.319, 2296231099371, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.319, 2296231099693, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.319, 2296231099904, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.HttpStatusCodeResultTests.HttpStatusCodeResult_ExecuteResultSetsResponseStatusCode Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.319, 2296231100078, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Information: 0 : 7340, 15, 2017/05/12, 14:46:26.320, 2296231103948, testhost.dll, AssemblyResolver: Moq.resources: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 7340, 15, 2017/05/12, 14:46:26.321, 2296231105746, testhost.dll, AssemblyResolver: Moq.resources: Resolving assembly.
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.336, 2296231150616, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.336, 2296231151249, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.336, 2296231151627, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.336, 2296231151887, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.AuthorizationApplicationModelProviderTest.OnProvidersExecuting_DefaultPolicyProvider_NoAuthorizationData_NoFilterCreated Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.337, 2296231152151, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.337, 2296231152653, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.337, 2296231153361, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.337, 2296231154267, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.DefaultValues Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.338, 2296231155289, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.364, 2296231232490, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.364, 2296231233502, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.364, 2296231233763, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.AuthorizationApplicationModelProviderTest.BuildActionModels_BaseAuthorizeFiltersAreStillValidWhenOverriden Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.365, 2296231234018, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.365, 2296231234496, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ReferenceEqualityComparerTest.GetHashCode_DoesNotThrowForNull Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.365, 2296231235011, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.IsRequired_ReturnsFalse_ForNullableTypes(modelType: typeof(int?)) Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.365, 2296231236582, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.386, 2296231296645, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.386, 2296231297345, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.386, 2296231297586, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ReferenceEqualityComparerTest.Equals_NullEqualsNull Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.386, 2296231298024, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.387, 2296231298477, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.387, 2296231298994, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.AuthorizationApplicationModelProviderTest.CreateControllerModelAndActionModel_AllowAnonymousAttributeAddsAllowAnonymousFilter Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.387, 2296231300245, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_SelectDefaultFormatter_OnAllMediaRangeAcceptHeaderMediaType(acceptHeader: "text/html,application/xhtml+xml,application/xml;q="..., expectedContentType: "application/json; charset=utf-8") Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.387, 2296231300781, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.418, 2296231389989, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.418, 2296231390966, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.418, 2296231391249, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_SelectDefaultFormatter_OnAllMediaRangeAcceptHeaderMediaType(acceptHeader: "*/*", expectedContentType: "application/json; charset=utf-8") Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.418, 2296231391545, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.419, 2296231392686, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.DefaultFilterProviderTest.DefaultFilterProvider_UsesFilterFactory Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.419, 2296231394117, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.IsReadOnly_ReturnsTrue_ForPrivateSetProperty Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.419, 2296231394412, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.452, 2296231489945, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.452, 2296231490714, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.452, 2296231491331, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.453, 2296231491860, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.453, 2296231492380, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.453, 2296231492876, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.453, 2296231493390, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.453, 2296231493846, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.453, 2296231494319, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.454, 2296231494832, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.454, 2296231495078, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributesTest.GetAttributesForBaseProperty_IncludesMetadataAttributes Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.454, 2296231495345, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.454, 2296231495609, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.454, 2296231495952, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.475, 2296231559042, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.497, 2296231621740, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.497, 2296231622047, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributesTest.GetAttributesForBasePropertyFromDerivedModel_IncludesMetadataAttributes Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.497, 2296231622299, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.497, 2296231622788, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.498, 2296231625320, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ObjectResult_PerformsContentNegotiation_OnAllMediaRangeAcceptHeaderMediaType(acceptHeader: "text/html,*/*;q=0.8,application/xml;q=0.9", expectedContentType: "application/xml; charset=utf-8") Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.498, 2296231625623, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.519, 2296231686784, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.519, 2296231687393, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.519, 2296231687929, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.520, 2296231688432, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.520, 2296231688899, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.520, 2296231689363, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.520, 2296231689933, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.AuthorizationApplicationModelProviderTest.OnProvidersExecuting_NonDefaultPolicyProvider_HasNoPolicy_HasPolicyProviderAndAuthorizeData Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.520, 2296231690529, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.521, 2296231691077, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.521, 2296231691588, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.521, 2296231692105, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.DefaultFilterProviderTest.DefaultFilterProvider_UsesFilterFactory_WithIFilterContainer Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.521, 2296231692338, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.555, 2296231791308, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.555, 2296231792089, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.555, 2296231792544, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.ExecuteResultAsync_ThrowsIfActionUrlIsNullOrEmpty(returnValue: "") Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.555, 2296231792931, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_MatchAllContentType_Throws(contentTypes: ["*/*"], invalidContentType: "*/*") Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.556, 2296231793934, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ChallengeResultTest.ChallengeResult_Execute Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.556, 2296231794560, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.578, 2296231858377, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.578, 2296231859156, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.578, 2296231859463, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_MatchAllContentType_Throws(contentTypes: ["*/*", "application/json"], invalidContentType: "*/*") Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.578, 2296231859840, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.578, 2296231860441, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.578, 2296231860942, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilterTest.OnActionExecuting_DoesNotChangeActionResult_IfOtherExceptionsAreFoundOnModelState Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.579, 2296231862973, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.621, 2296231986570, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.622, 2296231987651, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.622, 2296231987981, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilterTest.OnActionExecuting_DoesNotChangeActionResult_IfOtherErrorsAreFoundOnModelState Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.622, 2296231988322, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.622, 2296231988862, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.622, 2296231989078, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.SelectFormatter_WithMultipleProvidedContentTypes_DoesConneg Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.622, 2296231989761, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.SelectFormatter_WithMultipleProvidedContentTypes_DoesConneg Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.623, 2296231990697, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.SelectFormatter_WithMultipleProvidedContentTypes_DoesConneg Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.623, 2296231991261, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.SelectFormatter_WithMultipleProvidedContentTypes_DoesConneg Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.623, 2296231991760, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.SelectFormatter_WithMultipleProvidedContentTypes_DoesConneg Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.623, 2296231992422, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.ExecuteResultAsync_ThrowsIfActionUrlIsNullOrEmpty(returnValue: null) Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.624, 2296231992877, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.643, 2296232050177, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.643, 2296232051058, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.643, 2296232051369, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.SelectFormatter_WithAcceptHeaderAndContentTypes_SetsContentTypeIsServerDefinedWhenExpected Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.644, 2296232051676, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.644, 2296232052232, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ChallengeResultTest.ChallengeResult_ExecuteNoSchemes Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.644, 2296232052867, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.644, 2296232053428, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.Constructor_InitializesControllerName(controllerName: "") Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.645, 2296232054811, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.664, 2296232110598, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.664, 2296232111569, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.664, 2296232111950, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_WithOneProvidedContentType_FromResponseContentType_NoFallback Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.664, 2296232112236, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.664, 2296232112828, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.665, 2296232113829, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.665, 2296232114895, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.665, 2296232115785, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.666, 2296232116417, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.FilterFactoryTest.GetAllFilters_CachesAllFilters Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.666, 2296232117531, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.698, 2296232211061, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.698, 2296232212186, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.699, 2296232212543, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.FilterFactoryTest.GetAllFilters_DoesNotCacheFiltersWithIsReusableFalse Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.699, 2296232212763, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.699, 2296232213589, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_FallsBackOnFormattersInOptions Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.699, 2296232214235, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.699, 2296232214651, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.699, 2296232215146, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ByteArrayModelBinderTests.BindModel Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.700, 2296232215639, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.PropertiesProperty_WithDefaultOrder_OrdersPropertyNamesAsProvided Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.700, 2296232216080, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.PropertiesProperty_WithDefaultOrder_OrdersPropertyNamesAsProvided Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.700, 2296232216586, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.718, 2296232270493, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.719, 2296232271820, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.PropertiesProperty_WithDefaultOrder_OrdersPropertyNamesAsProvided Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.719, 2296232272422, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.FilterFactoryTest.GetAllFilters_CachesFilterFromFactory Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.719, 2296232273038, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.PropertiesProperty_WithDefaultOrder_OrdersPropertyNamesAsProvided Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.720, 2296232274788, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ByteArrayModelBinderTests.BindModelSetsModelToNullOnNullOrEmptyString(value: "") Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.720, 2296232275103, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.757, 2296232382729, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.757, 2296232383512, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.757, 2296232384187, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.PropertiesSetOnce Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.758, 2296232385513, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Internal.DefaultFilterProviderTest.DefaultFilterProvider_UsesFilterFactory_WithOrder Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.758, 2296232386667, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.ExecuteResultAsync_SetsStatusCodeAndLocationHeader Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.758, 2296232387109, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.794, 2296232493307, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.795, 2296232494268, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.795, 2296232494585, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.ElementMetadata_ReturnsExpectedMetadata(modelType: typeof(System.Collections.ObjectModel.Collection<int>), elementType: typeof(int)) Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.795, 2296232494872, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.795, 2296232495357, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.797, 2296232501211, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.797, 2296232502098, testhost.dll, InProgressTests is null
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.798, 2296232503780, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ByteArrayModelBinderTests.BindModelAddsModelErrorsOnInvalidCharacters Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.798, 2296232504488, testhost.dll, Sending test run statistics
|
||||||
|
TpTrace Verbose: 0 : 7340, 12, 2017/05/12, 14:46:26.823, 2296232577472, testhost.dll, TestRunCache: OnNewTestResult: Notified the onCacheHit callback.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.831, 2296232600301, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ByteArrayModelBinderTests.BindModel_ReturnsWithIsModelSetFalse_WhenValueNotFound Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.831, 2296232601807, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.OnFormatting_NullContext_ThrowsArgumentNullException Passed' in inProgress list.
|
||||||
|
TpTrace Warning: 0 : 7340, 12, 2017/05/12, 14:46:26.832, 2296232603080, testhost.dll, TestRunCache: No test found corresponding to testResult 'Microsoft.AspNetCore.Mvc.Formatters.TextOutputFormatterTests.SelectResponseCharacterEncoding_SelectsEncoding(acceptCharsetHeaders: "utf-16; q=0.5", supportedEncodings: ["utf-8", "utf-16"], expectedEncoding: "utf-16") Passed' in inProgress list.
|
||||||
|
TpTrace Information: 0 : 7340, 12, 2017/05/12, 14:46:26.832, 2296232603497, testhost.dll, Sending test run statistics
|
||||||
|
|
@ -0,0 +1,172 @@
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:18.953, 2296209529728, vstest.console.dll, Using .Net Framework version:.NETCoreApp,Version=v2.0
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:18.998, 2296209653022, vstest.console.dll, TestPluginCache: Discovering the extensions using extension path.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:19.001, 2296209661337, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.TestHostRuntimeProvider: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:19.003, 2296209666162, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.TestHostRuntimeProvider: Resolved assembly.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:19.006, 2296209676477, vstest.console.dll, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:19.008, 2296209680971, vstest.console.dll, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger: Resolved assembly.
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.010, 2296209688504, vstest.console.dll, TestPluginCache: Discovered the extensions using extension path ''.
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.011, 2296209689400, vstest.console.dll, TestPluginCache: Discoverers are ''.
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.011, 2296209689928, vstest.console.dll, TestPluginCache: Executors are ''.
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.011, 2296209690442, vstest.console.dll, TestPluginCache: Setting providers are ''.
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.011, 2296209690923, vstest.console.dll, TestPluginCache: Loggers are 'logger://Microsoft/TestPlatform/TrxLogger/v2'.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:19.033, 2296209754849, vstest.console.dll, RunTestsArgumentProcessor:Execute: Test run is starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.033, 2296209755453, vstest.console.dll, RunTestsArgumentProcessor:Execute: Queuing Test run.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:19.033, 2296209756222, vstest.console.dll, TestRequestManager.RunTests: run tests started.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:19.086, 2296209908971, vstest.console.dll, TestPluginManager.CreateTestExtension: Attempting to load test extension: Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DefaultTestHostManager
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:19.086, 2296209910233, vstest.console.dll, TestPluginManager.CreateTestExtension: Attempting to load test extension: Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.087, 2296209912861, vstest.console.dll, TestEngine: Initializing Parallel Execution as MaxCpuCount is set to: 1
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.096, 2296209940729, vstest.console.dll, TestRunRequest.ExecuteAsync: Creating test run request.
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.097, 2296209942353, vstest.console.dll, TestRunRequest.ExecuteAsync: Starting.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:19.097, 2296209943116, vstest.console.dll, TestRunRequest.ExecuteAsync: Starting run with settings:TestRunCriteria:
|
||||||
|
KeepAlive=False,FrequencyOfRunStatsChangeEvent=10,RunStatsChangeEventTimeout=00:00:01.5000000,TestCaseFilter=,TestExecutorLauncher=
|
||||||
|
Settingsxml=<?xml version="1.0" encoding="utf-16"?>
|
||||||
|
<RunSettings>
|
||||||
|
<RunConfiguration>
|
||||||
|
<ResultsDirectory>D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\TestResults</ResultsDirectory>
|
||||||
|
<TargetPlatform>X86</TargetPlatform>
|
||||||
|
<TargetFrameworkVersion>.NETCoreApp,Version=v2.0</TargetFrameworkVersion>
|
||||||
|
</RunConfiguration>
|
||||||
|
</RunSettings>
|
||||||
|
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.097, 2296209943354, vstest.console.dll, TestRunRequest.ExecuteAsync: Wait for the first run request is over.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:19.099, 2296209948803, vstest.console.dll, TestRunRequest.ExecuteAsync: Started.
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:19.099, 2296209949515, vstest.console.dll, TestRunRequest.WaitForCompletion: Waiting with timeout -1.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:19.099, 2296209949680, vstest.console.dll, ProxyParallelExecutionManager: Triggering test run for next source: D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\bin\Debug\netcoreapp2.0\Microsoft.AspNetCore.Mvc.Core.Test.dll
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:19.100, 2296209951000, vstest.console.dll, ProxyExecutionManager: Test host is non shared. Lazy initialize.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:19.153, 2296210107110, vstest.console.dll, Listening on port : 64746
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:19.167, 2296210147124, vstest.console.dll, DotnetTestHostmanager: Full path of dotnet.exe is C:\Users\Pranav\.dotnet\x64\dotnet.exe
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:19.167, 2296210147773, vstest.console.dll, DotnetTestHostmanager: Adding --runtimeconfig "D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\bin\Debug\netcoreapp2.0\Microsoft.AspNetCore.Mvc.Core.Test.runtimeconfig.json" in args
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:19.167, 2296210148038, vstest.console.dll, DotnetTestHostmanager: Adding --depsfile "D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\bin\Debug\netcoreapp2.0\Microsoft.AspNetCore.Mvc.Core.Test.deps.json" in args
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:19.167, 2296210148469, vstest.console.dll, AssemblyResolver: Microsoft.Extensions.DependencyModel: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:19.168, 2296210150826, vstest.console.dll, AssemblyResolver: Microsoft.Extensions.DependencyModel: Resolved assembly.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:19.168, 2296210151668, vstest.console.dll, DotnetTestHostmanager: Reading file D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\bin\Debug\netcoreapp2.0\Microsoft.AspNetCore.Mvc.Core.Test.deps.json to get path of testhost.dll
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:19.220, 2296210304147, vstest.console.dll, DotnetTestHostmanager: Relative path of testhost.dll with respect to package folder is microsoft.testplatform.testhost/15.0.0\lib/netstandard1.5/testhost.dll
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:19.225, 2296210317542, vstest.console.dll, DotnetTestHostmanager: Looking for path microsoft.testplatform.testhost/15.0.0\lib/netstandard1.5/testhost.dll in folder C:\Users\Pranav\.nuget\packages
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:19.225, 2296210318273, vstest.console.dll, DotnetTestHostmanager: Full path of testhost.dll is C:\Users\Pranav\.nuget\packages\microsoft.testplatform.testhost/15.0.0\lib/netstandard1.5/testhost.dll
|
||||||
|
TpTrace Verbose: 0 : 17636, 5, 2017/05/12, 14:46:19.227, 2296210324293, vstest.console.dll, DotnetTestHostManager: Starting process 'C:\Users\Pranav\.dotnet\x64\dotnet.exe' with command line 'exec --runtimeconfig "D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\bin\Debug\netcoreapp2.0\Microsoft.AspNetCore.Mvc.Core.Test.runtimeconfig.json" --depsfile "D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\bin\Debug\netcoreapp2.0\Microsoft.AspNetCore.Mvc.Core.Test.deps.json" "C:\Users\Pranav\.nuget\packages\microsoft.testplatform.testhost/15.0.0\lib/netstandard1.5/testhost.dll" --port 64746 --parentprocessid 17636 --diag "D:\work\Mvc\test\Microsoft.AspNetCore.Mvc.Core.Test\out.host.17-05-12_14-46-19_16053_4.txt"'
|
||||||
|
TpTrace Verbose: 0 : 17636, 5, 2017/05/12, 14:46:19.241, 2296210364355, vstest.console.dll, Test Runtime launched with Pid: 7340
|
||||||
|
TpTrace Information: 0 : 17636, 6, 2017/05/12, 14:46:19.619, 2296211472265, vstest.console.dll, Accepted Client request and set the flag
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:19.787, 2296211962805, vstest.console.dll, TestRunRequest:SendTestRunMessage: Starting.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:19.787, 2296211963963, vstest.console.dll, TestRunRequest:SendTestRunMessage: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:21.689, 2296217536188, vstest.console.dll, TestRunRequest:SendTestRunMessage: Starting.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:21.689, 2296217536624, vstest.console.dll, TestRunRequest:SendTestRunMessage: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:24.893, 2296226922082, vstest.console.dll, TestRunRequest:SendTestRunMessage: Starting.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:24.893, 2296226922397, vstest.console.dll, TestRunRequest:SendTestRunMessage: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.011, 2296230198328, vstest.console.dll, TestRunRequest:SendTestRunMessage: Starting.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.011, 2296230198818, vstest.console.dll, TestRunRequest:SendTestRunMessage: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.199, 2296230750425, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.200, 2296230751176, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.DefaultFilterProviderTest.DefaultFilterProvider_UsesFilter_WhenItsNotIFilterFactory
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.200, 2296230751666, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.277, 2296230978862, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.278, 2296230979323, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_SelectDefaultFormatter_OnAllMediaRangeAcceptHeaderMediaType(acceptHeader: "text/html,application/xhtml+xml,application/xml;q="..., expectedContentType: "application/json; charset=utf-8")
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.278, 2296230979464, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.AuthorizationApplicationModelProviderTest.OnProvidersExecuting_DefaultPolicyProvider_NoAuthorizationData_NoFilterCreated
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.278, 2296230979576, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.MiddlewareFilterTest.UnhandledException_InMiddleware_PropagatesBackToInvoker
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.278, 2296230979676, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.DefaultValues
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.278, 2296230979775, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.HttpStatusCodeResultTests.HttpStatusCodeResult_ExecuteResultSetsResponseStatusCode
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.278, 2296230979916, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.DefaultModelMetadataBindingDetailsProviderTest.CreateBindingDetails_BindingBehaviorLeftAlone_ForAttributeOnPropertyType(initialValue: False)
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.278, 2296230980020, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.Constructor_InitializesActionName(actionName: null)
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.278, 2296230980612, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.305, 2296231058735, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.305, 2296231059242, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.ExecuteResultAsync_ThrowsIfActionUrlIsNullOrEmpty(returnValue: "")
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.305, 2296231059476, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.DefaultFilterProviderTest.DefaultFilterProvider_UsesFilterFactory
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.305, 2296231059668, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.DefaultModelMetadataBindingDetailsProviderTest.CreateBindingDetails_FindsBindNever_OnContainerClass
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.305, 2296231060066, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.326, 2296231121258, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.326, 2296231121752, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.DefaultModelMetadataBindingDetailsProviderTest.CreateBindingDetails_FindsBindNever_OnProperty
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.326, 2296231122073, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.348, 2296231186087, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.348, 2296231186655, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.372, 2296231255179, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.372, 2296231255669, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.AuthorizationApplicationModelProviderTest.BuildActionModels_BaseAuthorizeFiltersAreStillValidWhenOverriden
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.372, 2296231255874, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ChallengeResultTest.ChallengeResult_Execute
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.372, 2296231256063, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ReferenceEqualityComparerTest.GetHashCode_DoesNotThrowForNull
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.372, 2296231256253, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.IsRequired_ReturnsFalse_ForNullableTypes(modelType: typeof(int?))
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.372, 2296231256566, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.396, 2296231325482, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.396, 2296231326084, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.AuthorizationApplicationModelProviderTest.CreateControllerModelAndActionModel_AllowAnonymousAttributeAddsAllowAnonymousFilter
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.396, 2296231326311, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.IsReadOnly_ReturnsTrue_ForPrivateSetProperty
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.396, 2296231326430, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ReferenceEqualityComparerTest.Equals_NullEqualsNull
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.396, 2296231326629, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.426, 2296231415383, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.427, 2296231416055, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.AuthorizationApplicationModelProviderTest.OnProvidersExecuting_NonDefaultPolicyProvider_HasNoPolicy_HasPolicyProviderAndAuthorizeData
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.427, 2296231416311, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_SelectDefaultFormatter_OnAllMediaRangeAcceptHeaderMediaType(acceptHeader: "*/*", expectedContentType: "application/json; charset=utf-8")
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.427, 2296231416604, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.463, 2296231521555, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.463, 2296231522109, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.DefaultFilterProviderTest.DefaultFilterProvider_UsesFilterFactory_WithIFilterContainer
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.463, 2296231522335, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributesTest.GetAttributesForBaseProperty_IncludesMetadataAttributes
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.463, 2296231522541, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ObjectResult_PerformsContentNegotiation_OnAllMediaRangeAcceptHeaderMediaType(acceptHeader: "text/html,*/*;q=0.8,application/xml;q=0.9", expectedContentType: "application/xml; charset=utf-8")
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.463, 2296231522866, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.485, 2296231585808, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.492, 2296231607920, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributesTest.GetAttributesForBasePropertyFromDerivedModel_IncludesMetadataAttributes
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.492, 2296231608328, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.527, 2296231711250, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.528, 2296231711766, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.PropertiesProperty_WithDefaultOrder_OrdersPropertyNamesAsProvided
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.528, 2296231711993, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilterTest.OnActionExecuting_DoesNotChangeActionResult_IfOtherExceptionsAreFoundOnModelState
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.528, 2296231712321, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.564, 2296231817096, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.564, 2296231817584, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_MatchAllContentType_Throws(contentTypes: ["*/*"], invalidContentType: "*/*")
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.564, 2296231817953, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.589, 2296231892418, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.590, 2296231893479, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.DefaultFilterProviderTest.DefaultFilterProvider_UsesFilterFactory_WithOrder
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.590, 2296231893814, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.ExecuteResultAsync_ThrowsIfActionUrlIsNullOrEmpty(returnValue: null)
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.590, 2296231894243, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ChallengeResultTest.ChallengeResult_ExecuteNoSchemes
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.590, 2296231894425, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_MatchAllContentType_Throws(contentTypes: ["*/*", "application/json"], invalidContentType: "*/*")
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.590, 2296231894858, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.630, 2296232012237, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.631, 2296232013343, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.SelectFormatter_WithMultipleProvidedContentTypes_DoesConneg
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.631, 2296232013691, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilterTest.OnActionExecuting_DoesNotChangeActionResult_IfOtherErrorsAreFoundOnModelState
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.631, 2296232013999, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.656, 2296232088420, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.656, 2296232088979, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.FilterFactoryTest.GetAllFilters_CachesAllFilters
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.656, 2296232089185, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.SelectFormatter_WithAcceptHeaderAndContentTypes_SetsContentTypeIsServerDefinedWhenExpected
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.656, 2296232089350, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.Constructor_InitializesControllerName(controllerName: "")
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.657, 2296232089678, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.682, 2296232163655, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.682, 2296232164239, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_WithOneProvidedContentType_FromResponseContentType_NoFallback
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.682, 2296232164464, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.ExecuteResultAsync_SetsStatusCodeAndLocationHeader
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.682, 2296232164658, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ByteArrayModelBinderTests.BindModel
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.682, 2296232165031, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.708, 2296232239915, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.708, 2296232240592, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.FilterFactoryTest.GetAllFilters_DoesNotCacheFiltersWithIsReusableFalse
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.708, 2296232240876, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutorTest.ExecuteAsync_FallsBackOnFormattersInOptions
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.708, 2296232241276, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.753, 2296232373613, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.754, 2296232375335, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ByteArrayModelBinderTests.BindModelSetsModelToNullOnNullOrEmptyString(value: "")
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.754, 2296232375640, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.FilterFactoryTest.GetAllFilters_CachesFilterFromFactory
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.771, 2296232424687, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.787, 2296232470786, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.787, 2296232471351, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvokerTest.InvokeAction_InvokesAsyncResourceFilter_ThrowsUnhandledException
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.787, 2296232471500, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.PropertiesSetOnce
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.787, 2296232471707, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.805, 2296232525812, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.806, 2296232526306, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ByteArrayModelBinderTests.BindModelAddsModelErrorsOnInvalidCharacters
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.806, 2296232526580, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataTest.ElementMetadata_ReturnsExpectedMetadata(modelType: typeof(System.Collections.ObjectModel.Collection<int>), elementType: typeof(int))
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.806, 2296232526774, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.AcceptedAtActionResultTests.OnFormatting_NullContext_ThrowsArgumentNullException
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.806, 2296232527070, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.828, 2296232592590, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Starting.
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.828, 2296232593107, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.Formatters.TextOutputFormatterTests.SelectResponseCharacterEncoding_SelectsEncoding(acceptCharsetHeaders: "utf-16; q=0.5", supportedEncodings: ["utf-8", "utf-16"], expectedEncoding: "utf-16")
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:26.829, 2296232593386, vstest.console.dll, InProgress is Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ByteArrayModelBinderTests.BindModel_ReturnsWithIsModelSetFalse_WhenValueNotFound
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:26.829, 2296232593644, vstest.console.dll, TestRunRequest:SendTestRunStatsChange: Completed.
|
||||||
|
TpTrace Error: 0 : 17636, 11, 2017/05/12, 14:46:27.899, 2296235728284, vstest.console.dll, SocketCommunicationManager ReceiveMessage: failed to receive message System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
|
||||||
|
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
|
||||||
|
--- End of inner exception stack trace ---
|
||||||
|
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
|
||||||
|
at System.IO.BinaryReader.ReadString()
|
||||||
|
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.SocketCommunicationManager.TryReceiveRawMessage(CancellationToken cancellationToken)
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:27.900, 2296235731675, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.CommunicationUtilities.resources: Resolving assembly.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:27.901, 2296235735262, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.CommunicationUtilities.resources: Resolving assembly.
|
||||||
|
TpTrace Error: 0 : 17636, 4, 2017/05/12, 14:46:27.902, 2296235737773, vstest.console.dll, Unable to receive message from testhost: Unable to communicate with test host process.
|
||||||
|
TpTrace Error: 0 : 17636, 4, 2017/05/12, 14:46:27.902, 2296235739815, vstest.console.dll, Server: TestExecution: Aborting test run because System.IO.IOException: Unable to communicate with test host process.
|
||||||
|
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestSender.TryReceiveRawMessage()
|
||||||
|
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestSender.ListenAndReportTestResults(ITestRunEventsHandler testRunEventsHandler)
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:27.905, 2296235748028, vstest.console.dll, TestRunRequest:SendTestRunMessage: Starting.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:27.906, 2296235750849, vstest.console.dll, TestRunRequest:SendTestRunMessage: Completed.
|
||||||
|
TpTrace Error: 0 : 17636, 4, 2017/05/12, 14:46:27.953, 2296235886970, vstest.console.dll, Connection has been broken: not sending SessionEnd message
|
||||||
|
TpTrace Error: 0 : 17636, 5, 2017/05/12, 14:46:27.955, 2296235892907, vstest.console.dll, Connection has been broken: not sending SessionEnd message
|
||||||
|
TpTrace Verbose: 0 : 17636, 4, 2017/05/12, 14:46:27.980, 2296235966449, vstest.console.dll, TestRunRequest:TestRunComplete: Starting. IsAborted:True IsCanceled:False.
|
||||||
|
TpTrace Information: 0 : 17636, 4, 2017/05/12, 14:46:28.012, 2296236060503, vstest.console.dll, TestRunRequest:TestRunComplete: Completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:28.012, 2296236060856, vstest.console.dll, TestRunRequest.Dispose: Starting.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:28.012, 2296236061195, vstest.console.dll, TestRunRequest.Dispose: Completed.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:28.012, 2296236061382, vstest.console.dll, TestRequestManager.RunTests: run tests completed, sucessful: True.
|
||||||
|
TpTrace Information: 0 : 17636, 2, 2017/05/12, 14:46:28.012, 2296236061500, vstest.console.dll, RunTestsArgumentProcessor:Execute: Test run is completed.
|
||||||
|
TpTrace Verbose: 0 : 17636, 2, 2017/05/12, 14:46:28.012, 2296236061645, vstest.console.dll, Executor.Execute: Exiting with exit code of 1
|
||||||
Loading…
Reference in New Issue