2016-08-08 21:52:46 +03:00
|
|
|
|
// 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.
|
2012-11-10 00:06:58 +04:00
|
|
|
|
|
|
|
|
|
using System.Web.Http.Tracing;
|
|
|
|
|
using Microsoft.TestCommon;
|
|
|
|
|
|
|
|
|
|
namespace System.Web.Http.Test
|
|
|
|
|
{
|
|
|
|
|
public class HttpConfigurationTracingExtensionsTest
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void EnableSystemDiagnosticsTracing_Adds_TraceWriter()
|
|
|
|
|
{
|
|
|
|
|
HttpConfiguration config = new HttpConfiguration();
|
|
|
|
|
SystemDiagnosticsTraceWriter returnedTraceWriter = config.EnableSystemDiagnosticsTracing();
|
|
|
|
|
ITraceWriter setTraceWriter = config.Services.GetService(typeof(ITraceWriter)) as ITraceWriter;
|
|
|
|
|
|
|
|
|
|
Assert.ReferenceEquals(returnedTraceWriter, setTraceWriter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void EnableSystemDiagnosticsTracing_ThrowsIfNull()
|
|
|
|
|
{
|
|
|
|
|
Assert.ThrowsArgumentNull(() => HttpConfigurationTracingExtensions.EnableSystemDiagnosticsTracing(null), "configuration");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|