Use TelemetrySource
This commit is contained in:
parent
2834b70987
commit
465b4ce0df
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23017.0
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DAAE4C74-D06F-4874-A166-33305D2643CE}"
|
||||
EndProject
|
||||
|
|
@ -88,6 +88,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Locali
|
|||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Localization.Test", "test\Microsoft.AspNet.Mvc.Localization.Test\Microsoft.AspNet.Mvc.Localization.Test.xproj", "{8FC726B5-E766-44E0-8B38-1313B6D8D9A7}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.TestTelemetryListener.Sources", "test\Microsoft.AspNet.Mvc.TestTelemetryListener.Sources\Microsoft.AspNet.Mvc.TestTelemetryListener.Sources.xproj", "{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -518,6 +520,18 @@ Global
|
|||
{8FC726B5-E766-44E0-8B38-1313B6D8D9A7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{8FC726B5-E766-44E0-8B38-1313B6D8D9A7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8FC726B5-E766-44E0-8B38-1313B6D8D9A7}.Release|x86.Build.0 = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -560,5 +574,6 @@ Global
|
|||
{827DBBCB-F3A9-4BAD-8262-4BD43E28EB3B} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
{50893B10-5735-4F35-9995-F81DA3F0189E} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
|
||||
{8FC726B5-E766-44E0-8B38-1313B6D8D9A7} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
15
Mvc.sln
15
Mvc.sln
|
|
@ -186,6 +186,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Locali
|
|||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Localization.Test", "test\Microsoft.AspNet.Mvc.Localization.Test\Microsoft.AspNet.Mvc.Localization.Test.xproj", "{8FC726B5-E766-44E0-8B38-1313B6D8D9A7}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.TestTelemetryListener.Sources", "test\Microsoft.AspNet.Mvc.TestTelemetryListener.Sources\Microsoft.AspNet.Mvc.TestTelemetryListener.Sources.xproj", "{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -1140,6 +1142,18 @@ Global
|
|||
{8FC726B5-E766-44E0-8B38-1313B6D8D9A7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{8FC726B5-E766-44E0-8B38-1313B6D8D9A7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8FC726B5-E766-44E0-8B38-1313B6D8D9A7}.Release|x86.Build.0 = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -1231,5 +1245,6 @@ Global
|
|||
{60873DFA-97B9-419E-BAA3-940FC9B07085} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
{50893B10-5735-4F35-9995-F81DA3F0189E} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
|
||||
{8FC726B5-E766-44E0-8B38-1313B6D8D9A7} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
{9879B5D5-2325-4A81-B4DF-F279FE8FEEB4} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc.ActionResults;
|
||||
|
|
@ -14,7 +15,6 @@ using Microsoft.AspNet.Mvc.ModelBinding;
|
|||
using Microsoft.AspNet.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Notification;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Actions
|
||||
{
|
||||
|
|
@ -37,7 +37,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
[NotNull] IReadOnlyList<IValueProviderFactory> valueProviderFactories,
|
||||
[NotNull] IActionBindingContextAccessor actionBindingContextAccessor,
|
||||
[NotNull] ILogger logger,
|
||||
[NotNull] INotifier notifier,
|
||||
[NotNull] TelemetrySource telemetry,
|
||||
int maxModelValidationErrors)
|
||||
: base(
|
||||
actionContext,
|
||||
|
|
@ -49,7 +49,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
valueProviderFactories,
|
||||
actionBindingContextAccessor,
|
||||
logger,
|
||||
notifier,
|
||||
telemetry,
|
||||
maxModelValidationErrors)
|
||||
{
|
||||
_descriptor = descriptor;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.Mvc.Filters;
|
||||
using Microsoft.AspNet.Mvc.Formatters;
|
||||
|
|
@ -9,7 +10,6 @@ using Microsoft.AspNet.Mvc.ModelBinding;
|
|||
using Microsoft.AspNet.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Notification;
|
||||
using Microsoft.Framework.OptionsModel;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Actions
|
||||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
private readonly IActionBindingContextAccessor _actionBindingContextAccessor;
|
||||
private readonly int _maxModelValidationErrors;
|
||||
private readonly ILogger _logger;
|
||||
private readonly INotifier _notifier;
|
||||
private readonly TelemetrySource _telemetry;
|
||||
|
||||
public ControllerActionInvokerProvider(
|
||||
IControllerFactory controllerFactory,
|
||||
|
|
@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
IOptions<MvcOptions> optionsAccessor,
|
||||
IActionBindingContextAccessor actionBindingContextAccessor,
|
||||
ILoggerFactory loggerFactory,
|
||||
INotifier notifier)
|
||||
TelemetrySource telemetry)
|
||||
{
|
||||
_controllerFactory = controllerFactory;
|
||||
_filterProviders = filterProviders.OrderBy(item => item.Order).ToArray();
|
||||
|
|
@ -49,7 +49,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
_actionBindingContextAccessor = actionBindingContextAccessor;
|
||||
_maxModelValidationErrors = optionsAccessor.Value.MaxModelValidationErrors;
|
||||
_logger = loggerFactory.CreateLogger<ControllerActionInvoker>();
|
||||
_notifier = notifier;
|
||||
_telemetry = telemetry;
|
||||
}
|
||||
|
||||
public int Order
|
||||
|
|
@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
_valueProviderFactories,
|
||||
_actionBindingContextAccessor,
|
||||
_logger,
|
||||
_notifier,
|
||||
_telemetry,
|
||||
_maxModelValidationErrors);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Linq;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -16,7 +17,6 @@ using Microsoft.AspNet.Mvc.ModelBinding;
|
|||
using Microsoft.AspNet.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Notification;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Actions
|
||||
{
|
||||
|
|
@ -30,7 +30,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
private readonly IReadOnlyList<IValueProviderFactory> _valueProviderFactories;
|
||||
private readonly IActionBindingContextAccessor _actionBindingContextAccessor;
|
||||
private readonly ILogger _logger;
|
||||
private readonly INotifier _notifier;
|
||||
private readonly TelemetrySource _telemetry;
|
||||
private readonly int _maxModelValidationErrors;
|
||||
|
||||
private IFilterMetadata[] _filters;
|
||||
|
|
@ -70,7 +70,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
[NotNull] IReadOnlyList<IValueProviderFactory> valueProviderFactories,
|
||||
[NotNull] IActionBindingContextAccessor actionBindingContextAccessor,
|
||||
[NotNull] ILogger logger,
|
||||
[NotNull] INotifier notifier,
|
||||
[NotNull] TelemetrySource telemetry,
|
||||
int maxModelValidationErrors)
|
||||
{
|
||||
ActionContext = actionContext;
|
||||
|
|
@ -83,7 +83,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
_valueProviderFactories = valueProviderFactories;
|
||||
_actionBindingContextAccessor = actionBindingContextAccessor;
|
||||
_logger = logger;
|
||||
_notifier = notifier;
|
||||
_telemetry = telemetry;
|
||||
_maxModelValidationErrors = maxModelValidationErrors;
|
||||
}
|
||||
|
||||
|
|
@ -571,9 +571,9 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
|
||||
try
|
||||
{
|
||||
if (_notifier.ShouldNotify("Microsoft.AspNet.Mvc.BeforeActionMethod"))
|
||||
if (_telemetry.IsEnabled("Microsoft.AspNet.Mvc.BeforeActionMethod"))
|
||||
{
|
||||
_notifier.Notify(
|
||||
_telemetry.WriteTelemetry(
|
||||
"Microsoft.AspNet.Mvc.BeforeActionMethod",
|
||||
new { actionContext = ActionContext, arguments = _actionExecutingContext.ActionArguments });
|
||||
}
|
||||
|
|
@ -582,9 +582,9 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (_notifier.ShouldNotify("Microsoft.AspNet.Mvc.AfterActionMethod"))
|
||||
if (_telemetry.IsEnabled("Microsoft.AspNet.Mvc.AfterActionMethod"))
|
||||
{
|
||||
_notifier.Notify(
|
||||
_telemetry.WriteTelemetry(
|
||||
"Microsoft.AspNet.Mvc.AfterActionMethod",
|
||||
new { actionContext = ActionContext, result });
|
||||
}
|
||||
|
|
@ -735,9 +735,9 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
|
||||
private async Task InvokeResultAsync(IActionResult result)
|
||||
{
|
||||
if (_notifier.ShouldNotify("Microsoft.AspNet.Mvc.BeforeActionResult"))
|
||||
if (_telemetry.IsEnabled("Microsoft.AspNet.Mvc.BeforeActionResult"))
|
||||
{
|
||||
_notifier.Notify(
|
||||
_telemetry.WriteTelemetry(
|
||||
"Microsoft.AspNet.Mvc.BeforeActionResult",
|
||||
new { actionContext = ActionContext, result });
|
||||
}
|
||||
|
|
@ -748,9 +748,9 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (_notifier.ShouldNotify("Microsoft.AspNet.Mvc.AfterActionResult"))
|
||||
if (_telemetry.IsEnabled("Microsoft.AspNet.Mvc.AfterActionResult"))
|
||||
{
|
||||
_notifier.Notify(
|
||||
_telemetry.WriteTelemetry(
|
||||
"Microsoft.AspNet.Mvc.AfterActionResult",
|
||||
new { actionContext = ActionContext, result });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc.Core;
|
||||
|
|
@ -10,7 +11,6 @@ using Microsoft.AspNet.Routing;
|
|||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Notification;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Actions
|
||||
{
|
||||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
private IActionInvokerFactory _actionInvokerFactory;
|
||||
private IActionSelector _actionSelector;
|
||||
private ILogger _logger;
|
||||
private INotifier _notifier;
|
||||
private TelemetrySource _telemetry;
|
||||
|
||||
public VirtualPathData GetVirtualPath([NotNull] VirtualPathContext context)
|
||||
{
|
||||
|
|
@ -70,9 +70,9 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
{
|
||||
context.RouteData = newRouteData;
|
||||
|
||||
if (_notifier.ShouldNotify("Microsoft.AspNet.Mvc.BeforeAction"))
|
||||
if (_telemetry.IsEnabled("Microsoft.AspNet.Mvc.BeforeAction"))
|
||||
{
|
||||
_notifier.Notify(
|
||||
_telemetry.WriteTelemetry(
|
||||
"Microsoft.AspNet.Mvc.BeforeAction",
|
||||
new { actionDescriptor, httpContext = context.HttpContext, routeData = context.RouteData});
|
||||
}
|
||||
|
|
@ -87,9 +87,9 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (_notifier.ShouldNotify("Microsoft.AspNet.Mvc.AfterAction"))
|
||||
if (_telemetry.IsEnabled("Microsoft.AspNet.Mvc.AfterAction"))
|
||||
{
|
||||
_notifier.Notify(
|
||||
_telemetry.WriteTelemetry(
|
||||
"Microsoft.AspNet.Mvc.AfterAction",
|
||||
new { actionDescriptor, httpContext = context.HttpContext });
|
||||
}
|
||||
|
|
@ -140,9 +140,9 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
_logger = factory.CreateLogger<MvcRouteHandler>();
|
||||
}
|
||||
|
||||
if (_notifier == null)
|
||||
if (_telemetry == null)
|
||||
{
|
||||
_notifier = context.RequestServices.GetRequiredService<INotifier>();
|
||||
_telemetry = context.RequestServices.GetRequiredService<TelemetrySource>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Mvc.ActionConstraints;
|
||||
using Microsoft.AspNet.Mvc.Actions;
|
||||
|
|
@ -64,7 +66,7 @@ namespace Microsoft.Framework.DependencyInjection
|
|||
services.TryAddEnumerable(
|
||||
ServiceDescriptor.Transient<IActionDescriptorProvider, ControllerActionDescriptorProvider>());
|
||||
services.TryAddSingleton<IActionDescriptorsCollectionProvider, DefaultActionDescriptorsCollectionProvider>();
|
||||
|
||||
|
||||
//
|
||||
// Action Selection
|
||||
//
|
||||
|
|
@ -132,7 +134,18 @@ namespace Microsoft.Framework.DependencyInjection
|
|||
{
|
||||
services.AddOptions();
|
||||
services.AddRouting();
|
||||
services.AddNotifier();
|
||||
|
||||
// Registered as a Source for us, and as a Listener for consumers.
|
||||
if (!services.Any(s => s.ServiceType == typeof(TelemetrySource)))
|
||||
{
|
||||
var source = new TelemetryListener("Microsoft.AspNet");
|
||||
services.AddInstance<TelemetrySource>(source);
|
||||
|
||||
if (!services.Any(s => s.ServiceType == typeof(TelemetryListener)))
|
||||
{
|
||||
services.AddInstance<TelemetryListener>(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,48 @@
|
|||
{
|
||||
"description": "The core runtime components of ASP.NET MVC.",
|
||||
"version": "6.0.0-*",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/aspnet/mvc"
|
||||
"description": "The core runtime components of ASP.NET MVC.",
|
||||
"version": "6.0.0-*",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/aspnet/mvc"
|
||||
},
|
||||
"compilationOptions": {
|
||||
"warningsAsErrors": true
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Authorization": "1.0.0-*",
|
||||
"Microsoft.AspNet.FileProviders.Abstractions": "1.0.0-*",
|
||||
"Microsoft.AspNet.Hosting.Abstractions": "1.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.Abstractions": "6.0.0-*",
|
||||
"Microsoft.Dnx.Runtime.Abstractions": "1.0.0-*",
|
||||
"Microsoft.Framework.ClosedGenericMatcher.Sources": {
|
||||
"version": "1.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"compilationOptions": {
|
||||
"warningsAsErrors": true
|
||||
"Microsoft.Framework.Logging.Abstractions": "1.0.0-*",
|
||||
"Microsoft.Framework.NotNullAttribute.Sources": {
|
||||
"version": "1.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Authorization": "1.0.0-*",
|
||||
"Microsoft.AspNet.FileProviders.Abstractions": "1.0.0-*",
|
||||
"Microsoft.AspNet.Hosting.Abstractions": "1.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.Abstractions": "6.0.0-*",
|
||||
"Microsoft.Dnx.Runtime.Abstractions": "1.0.0-*",
|
||||
"Microsoft.Framework.ClosedGenericMatcher.Sources": { "version": "1.0.0-*", "type": "build" },
|
||||
"Microsoft.Framework.Logging.Abstractions": "1.0.0-*",
|
||||
"Microsoft.Framework.Notification": "1.0.0-*",
|
||||
"Microsoft.Framework.NotNullAttribute.Sources": { "version": "1.0.0-*", "type": "build" },
|
||||
"Microsoft.Framework.PropertyActivator.Sources": { "version": "1.0.0-*", "type": "build" },
|
||||
"Microsoft.Framework.PropertyHelper.Sources": { "version": "1.0.0-*", "type": "build" },
|
||||
"Microsoft.Framework.SecurityHelper.Sources": { "version": "1.0.0-*", "type": "build" }
|
||||
|
||||
"Microsoft.Framework.PropertyActivator.Sources": {
|
||||
"version": "1.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": { },
|
||||
"dnxcore50": { }
|
||||
}
|
||||
"Microsoft.Framework.PropertyHelper.Sources": {
|
||||
"version": "1.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"Microsoft.Framework.SecurityHelper.Sources": {
|
||||
"version": "1.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"System.Diagnostics.Tracing.Telemetry": "4.0.0-beta-*"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {
|
||||
"frameworkAssemblies": {
|
||||
"System.Runtime": ""
|
||||
}
|
||||
},
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ using Microsoft.Framework.Internal;
|
|||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Microsoft.Framework.OptionsModel;
|
||||
using Microsoft.Framework.Notification;
|
||||
using Microsoft.AspNet.Mvc.Actions;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.ActionResults
|
||||
{
|
||||
|
|
@ -28,7 +27,7 @@ namespace Microsoft.AspNet.Mvc.ActionResults
|
|||
/// Gets or sets the name of the view to render.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// When <c>null</c>, defaults to <see cref="ActionDescriptor.Name"/>.
|
||||
/// When <c>null</c>, defaults to <see cref="Actions.ActionDescriptor.Name"/>.
|
||||
/// </remarks>
|
||||
public string ViewName { get; set; }
|
||||
|
||||
|
|
@ -61,7 +60,7 @@ namespace Microsoft.AspNet.Mvc.ActionResults
|
|||
var viewEngine = ViewEngine ?? services.GetRequiredService<ICompositeViewEngine>();
|
||||
|
||||
var logger = services.GetRequiredService<ILogger<ViewResult>>();
|
||||
var notifier = services.GetRequiredService<INotifier>();
|
||||
var telemetry = services.GetRequiredService<TelemetrySource>();
|
||||
|
||||
var options = services.GetRequiredService<IOptions<MvcViewOptions>>();
|
||||
|
||||
|
|
@ -69,9 +68,9 @@ namespace Microsoft.AspNet.Mvc.ActionResults
|
|||
var viewEngineResult = viewEngine.FindView(context, viewName);
|
||||
if(!viewEngineResult.Success)
|
||||
{
|
||||
if (notifier.ShouldNotify("Microsoft.AspNet.Mvc.ViewResultViewNotFound"))
|
||||
if (telemetry.IsEnabled("Microsoft.AspNet.Mvc.ViewResultViewNotFound"))
|
||||
{
|
||||
notifier.Notify(
|
||||
telemetry.WriteTelemetry(
|
||||
"Microsoft.AspNet.Mvc.ViewResultViewNotFound",
|
||||
new
|
||||
{
|
||||
|
|
@ -89,9 +88,9 @@ namespace Microsoft.AspNet.Mvc.ActionResults
|
|||
}
|
||||
|
||||
var view = viewEngineResult.EnsureSuccessful().View;
|
||||
if (notifier.ShouldNotify("Microsoft.AspNet.Mvc.ViewResultViewFound"))
|
||||
if (telemetry.IsEnabled("Microsoft.AspNet.Mvc.ViewResultViewFound"))
|
||||
{
|
||||
notifier.Notify(
|
||||
telemetry.WriteTelemetry(
|
||||
"Microsoft.AspNet.Mvc.ViewResultViewFound",
|
||||
new { actionContext = context, result = this, viewName, view = view });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
|
@ -20,7 +21,6 @@ using Microsoft.AspNet.Testing;
|
|||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Logging.Testing;
|
||||
using Microsoft.Framework.Notification;
|
||||
using Microsoft.Framework.OptionsModel;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Moq;
|
||||
|
|
@ -2046,7 +2046,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
new IValueProviderFactory[0],
|
||||
new ActionBindingContextAccessor(),
|
||||
new NullLoggerFactory().CreateLogger<ControllerActionInvoker>(),
|
||||
new Notifier(new ProxyNotifierMethodAdapter()),
|
||||
new TelemetryListener("Microsoft.AspNet"),
|
||||
maxAllowedErrorsInModelState);
|
||||
|
||||
return invoker;
|
||||
|
|
@ -2107,7 +2107,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
new IValueProviderFactory[0],
|
||||
new ActionBindingContextAccessor(),
|
||||
new NullLoggerFactory().CreateLogger<ControllerActionInvoker>(),
|
||||
new Notifier(new ProxyNotifierMethodAdapter()),
|
||||
new TelemetryListener("Microsoft.AspNet"),
|
||||
200);
|
||||
|
||||
// Act
|
||||
|
|
@ -2208,7 +2208,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
IReadOnlyList<IValueProviderFactory> valueProviderFactories,
|
||||
IActionBindingContextAccessor actionBindingContext,
|
||||
ILogger logger,
|
||||
INotifier notifier,
|
||||
TelemetrySource telemetry,
|
||||
int maxAllowedErrorsInModelState)
|
||||
: base(
|
||||
actionContext,
|
||||
|
|
@ -2223,7 +2223,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
valueProviderFactories,
|
||||
actionBindingContext,
|
||||
logger,
|
||||
notifier,
|
||||
telemetry,
|
||||
maxAllowedErrorsInModelState)
|
||||
{
|
||||
ControllerFactory = controllerFactory;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,13 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc.Internal;
|
||||
using Microsoft.AspNet.Mvc.TestCommon.Notification;
|
||||
using Microsoft.AspNet.Routing;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Logging.Testing;
|
||||
using Microsoft.Framework.Notification;
|
||||
using Microsoft.Framework.OptionsModel;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
|
@ -158,9 +157,9 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
public async Task RouteAsync_Notifies_ActionSelected()
|
||||
{
|
||||
// Arrange
|
||||
var listener = new TestNotificationListener();
|
||||
var listener = new TestTelemetryListener();
|
||||
|
||||
var context = CreateRouteContext(notificationListener: listener);
|
||||
var context = CreateRouteContext(telemetryListener: listener);
|
||||
context.RouteData.Values.Add("tag", "value");
|
||||
|
||||
var handler = new MvcRouteHandler();
|
||||
|
|
@ -183,9 +182,9 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
public async Task RouteAsync_Notifies_ActionInvoked()
|
||||
{
|
||||
// Arrange
|
||||
var listener = new TestNotificationListener();
|
||||
var listener = new TestTelemetryListener();
|
||||
|
||||
var context = CreateRouteContext(notificationListener: listener);
|
||||
var context = CreateRouteContext(telemetryListener: listener);
|
||||
|
||||
var handler = new MvcRouteHandler();
|
||||
|
||||
|
|
@ -203,7 +202,7 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
IActionInvokerFactory invokerFactory = null,
|
||||
ILoggerFactory loggerFactory = null,
|
||||
IOptions<MvcOptions> optionsAccessor = null,
|
||||
object notificationListener = null)
|
||||
object telemetryListener = null)
|
||||
{
|
||||
if (actionDescriptor == null)
|
||||
{
|
||||
|
|
@ -243,10 +242,10 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
optionsAccessor = new TestOptionsManager<MvcOptions>();
|
||||
}
|
||||
|
||||
var notifier = new Notifier(new ProxyNotifierMethodAdapter());
|
||||
if (notificationListener != null)
|
||||
var telemetry = new TelemetryListener("Microsoft.AspNet");
|
||||
if (telemetryListener != null)
|
||||
{
|
||||
notifier.EnlistTarget(notificationListener);
|
||||
telemetry.SubscribeWithAdapter(telemetryListener);
|
||||
}
|
||||
|
||||
var httpContext = new Mock<HttpContext>();
|
||||
|
|
@ -262,8 +261,8 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
.Returns(new MvcMarkerService());
|
||||
httpContext.Setup(h => h.RequestServices.GetService(typeof(IOptions<MvcOptions>)))
|
||||
.Returns(optionsAccessor);
|
||||
httpContext.Setup(h => h.RequestServices.GetService(typeof(INotifier)))
|
||||
.Returns(notifier);
|
||||
httpContext.Setup(h => h.RequestServices.GetService(typeof(TelemetrySource)))
|
||||
.Returns(telemetry);
|
||||
|
||||
return new RouteContext(httpContext.Object);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,33 @@
|
|||
{
|
||||
"compilationOptions": {
|
||||
"warningsAsErrors": true
|
||||
"compilationOptions": {
|
||||
"warningsAsErrors": true
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Http": "1.0.0-*",
|
||||
"Microsoft.AspNet.Mvc": "6.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.TestCommon": {
|
||||
"version": "6.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Http": "1.0.0-*",
|
||||
"Microsoft.AspNet.Mvc": "6.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.TestCommon": {
|
||||
"version": "6.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*",
|
||||
"Microsoft.AspNet.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
|
||||
"Microsoft.Framework.Logging.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
|
||||
"Moq": "4.2.1312.1622",
|
||||
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
||||
"Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.TestTelemetryListener.Sources": {
|
||||
"version": "6.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"commands": {
|
||||
"test": "xunit.runner.aspnet"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {
|
||||
"compilationOptions": { "define": ["MOCK_SUPPORT"] }
|
||||
}
|
||||
"Microsoft.AspNet.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
|
||||
"Microsoft.Framework.Logging.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.TelemetryAdapter": "1.0.0-*",
|
||||
"Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
|
||||
"Moq": "4.2.1312.1622",
|
||||
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
||||
},
|
||||
"commands": {
|
||||
"test": "xunit.runner.aspnet"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {
|
||||
"compilationOptions": { "define": [ "MOCK_SUPPORT" ] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// 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.
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
||||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
public interface IProxyActionContext
|
||||
{
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
// 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.
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
||||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
public interface IProxyActionDescriptor
|
||||
{
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
// 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.
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
||||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
public interface IProxyActionResult
|
||||
{
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
// 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.
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
||||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
public interface IProxyHttpContext
|
||||
{
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
||||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
public interface IProxyRouteData
|
||||
{
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
// 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.
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
||||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
public interface IProxyView
|
||||
{
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>9879b5d5-2325-4a81-b4df-f279fe8feeb4</ProjectGuid>
|
||||
<RootNamespace>Microsoft.AspNet.Mvc.TestTelemetryListener.Sources</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Framework.Notification;
|
||||
using Microsoft.Framework.TelemetryAdapter;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
||||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
public class TestNotificationListener
|
||||
public class TestTelemetryListener
|
||||
{
|
||||
public class OnBeforeActionEventData
|
||||
{
|
||||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
|||
|
||||
public OnBeforeActionEventData BeforeAction { get; set; }
|
||||
|
||||
[NotificationName("Microsoft.AspNet.Mvc.BeforeAction")]
|
||||
[TelemetryName("Microsoft.AspNet.Mvc.BeforeAction")]
|
||||
public virtual void OnBeforeAction(
|
||||
IProxyHttpContext httpContext,
|
||||
IProxyRouteData routeData,
|
||||
|
|
@ -39,7 +39,7 @@ namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
|||
|
||||
public OnAfterActionEventData AfterAction { get; set; }
|
||||
|
||||
[NotificationName("Microsoft.AspNet.Mvc.AfterAction")]
|
||||
[TelemetryName("Microsoft.AspNet.Mvc.AfterAction")]
|
||||
public virtual void OnAfterAction(
|
||||
IProxyHttpContext httpContext,
|
||||
IProxyActionDescriptor actionDescriptor)
|
||||
|
|
@ -61,7 +61,7 @@ namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
|||
|
||||
public OnViewResultViewFoundEventData ViewResultViewFound { get; set; }
|
||||
|
||||
[NotificationName("Microsoft.AspNet.Mvc.ViewResultViewFound")]
|
||||
[TelemetryName("Microsoft.AspNet.Mvc.ViewResultViewFound")]
|
||||
public virtual void OnViewResultViewFound(
|
||||
IProxyActionContext actionContext,
|
||||
IProxyActionResult result,
|
||||
|
|
@ -87,7 +87,7 @@ namespace Microsoft.AspNet.Mvc.TestCommon.Notification
|
|||
|
||||
public OnViewResultViewNotFoundEventData ViewResultViewNotFound { get; set; }
|
||||
|
||||
[NotificationName("Microsoft.AspNet.Mvc.ViewResultViewNotFound")]
|
||||
[TelemetryName("Microsoft.AspNet.Mvc.ViewResultViewNotFound")]
|
||||
public virtual void OnViewResultViewNotFound(
|
||||
IProxyActionContext actionContext,
|
||||
IProxyActionResult result,
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"version": "6.0.0-*",
|
||||
"shared": "**/*.cs",
|
||||
"frameworks": {
|
||||
"dnx451": { },
|
||||
"dnxcore50": {
|
||||
"dependencies": {
|
||||
"System.Runtime": "4.0.21-beta-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,17 +2,16 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Http.Internal;
|
||||
using Microsoft.AspNet.Mvc.Actions;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.AspNet.Mvc.TestCommon.Notification;
|
||||
using Microsoft.AspNet.Routing;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Notification;
|
||||
using Microsoft.Framework.OptionsModel;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Moq;
|
||||
|
|
@ -207,8 +206,14 @@ namespace Microsoft.AspNet.Mvc.ActionResults
|
|||
.Verifiable();
|
||||
|
||||
var serviceProvider = new Mock<IServiceProvider>();
|
||||
serviceProvider.Setup(s => s.GetService(typeof(INotifier)))
|
||||
.Returns(new Notifier(new ProxyNotifierMethodAdapter()));
|
||||
|
||||
var telemetry = new TelemetryListener("Microsoft.AspNet");
|
||||
serviceProvider
|
||||
.Setup(s => s.GetService(typeof(TelemetrySource)))
|
||||
.Returns(telemetry);
|
||||
serviceProvider
|
||||
.Setup(s => s.GetService(typeof(TelemetryListener)))
|
||||
.Returns(telemetry);
|
||||
serviceProvider.Setup(p => p.GetService(typeof(ICompositeViewEngine)))
|
||||
.Returns(viewEngine.Object);
|
||||
serviceProvider.Setup(p => p.GetService(typeof(ILogger<ViewResult>)))
|
||||
|
|
@ -242,8 +247,8 @@ namespace Microsoft.AspNet.Mvc.ActionResults
|
|||
var httpContext = GetHttpContext();
|
||||
var context = new ActionContext(httpContext, new RouteData(), new ActionDescriptor());
|
||||
|
||||
var listener = new TestNotificationListener();
|
||||
httpContext.RequestServices.GetRequiredService<INotifier>().EnlistTarget(listener);
|
||||
var listener = new TestTelemetryListener();
|
||||
httpContext.RequestServices.GetRequiredService<TelemetryListener>().SubscribeWithAdapter(listener);
|
||||
|
||||
var viewEngine = new Mock<IViewEngine>();
|
||||
var view = Mock.Of<IView>();
|
||||
|
|
@ -276,8 +281,8 @@ namespace Microsoft.AspNet.Mvc.ActionResults
|
|||
var httpContext = GetHttpContext();
|
||||
var context = new ActionContext(httpContext, new RouteData(), new ActionDescriptor());
|
||||
|
||||
var listener = new TestNotificationListener();
|
||||
httpContext.RequestServices.GetRequiredService<INotifier>().EnlistTarget(listener);
|
||||
var listener = new TestTelemetryListener();
|
||||
httpContext.RequestServices.GetRequiredService<TelemetryListener>().SubscribeWithAdapter(listener);
|
||||
|
||||
var viewEngine = new Mock<IViewEngine>();
|
||||
var view = Mock.Of<IView>();
|
||||
|
|
@ -316,9 +321,11 @@ namespace Microsoft.AspNet.Mvc.ActionResults
|
|||
serviceProvider.Setup(s => s.GetService(typeof(IOptions<MvcViewOptions>)))
|
||||
.Returns(optionsAccessor.Object);
|
||||
|
||||
serviceProvider.Setup(s => s.GetService(typeof(INotifier)))
|
||||
.Returns(new Notifier(new ProxyNotifierMethodAdapter()));
|
||||
|
||||
var telemetry = new TelemetryListener("Microsoft.AspNet");
|
||||
serviceProvider.Setup(s => s.GetService(typeof(TelemetryListener)))
|
||||
.Returns(telemetry);
|
||||
serviceProvider.Setup(s => s.GetService(typeof(TelemetrySource)))
|
||||
.Returns(telemetry);
|
||||
var httpContext = new DefaultHttpContext();
|
||||
httpContext.RequestServices = serviceProvider.Object;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +1,33 @@
|
|||
{
|
||||
"compilationOptions": {
|
||||
"warningsAsErrors": true
|
||||
"compilationOptions": {
|
||||
"warningsAsErrors": true
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Http": "1.0.0-*",
|
||||
"Microsoft.AspNet.Mvc": "6.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.TestCommon": {
|
||||
"version": "6.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Http": "1.0.0-*",
|
||||
"Microsoft.AspNet.Mvc": "6.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.TestCommon": { "version": "6.0.0-*", "type": "build" },
|
||||
"Microsoft.AspNet.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
|
||||
"Microsoft.Framework.Logging.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
|
||||
"Moq": "4.2.1312.1622",
|
||||
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
||||
"Microsoft.AspNet.Mvc.TestTelemetryListener.Sources": {
|
||||
"version": "6.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"commands": {
|
||||
"test": "xunit.runner.aspnet"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {
|
||||
"compilationOptions": { "define": ["MOCK_SUPPORT"] }
|
||||
}
|
||||
"Microsoft.AspNet.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
|
||||
"Microsoft.Framework.Logging.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.TelemetryAdapter": "1.0.0-*",
|
||||
"Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
|
||||
"Moq": "4.2.1312.1622",
|
||||
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
||||
},
|
||||
"commands": {
|
||||
"test": "xunit.runner.aspnet"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {
|
||||
"compilationOptions": { "define": [ "MOCK_SUPPORT" ] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue