Last active
February 1, 2018 15:32
-
-
Save arichika/e95e45904f1c096bad390f57c881245b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using Microsoft.Azure.WebJobs.Host; | |
namespace Samples.SampleBizLogic.Tests | |
{ | |
public class UnitTestTraceWriter : TraceWriter | |
{ | |
private readonly Action<TraceEvent> _traceAction; | |
public UnitTestTraceWriter(TraceLevel level, Action<TraceEvent> traceAction) : base(level) | |
{ | |
_traceAction = traceAction; | |
} | |
public override void Trace(TraceEvent traceEvent) | |
{ | |
_traceAction?.Invoke(traceEvent); | |
} | |
} | |
} | |
// --- | |
using System.Diagnostics; | |
using Xunit.Abstractions; | |
namespace Samples.SampleBizLogic.Tests | |
{ | |
public class UnitTestBase | |
{ | |
public readonly ITestOutputHelper _output; | |
private readonly UnitTestTraceWriter _traceWriter; | |
public UnitTestBase(ITestOutputHelper output) | |
{ | |
_output = output; | |
_traceWriter = new UnitTestTraceWriter( | |
TraceLevel.Verbose, | |
te => output.WriteLine($"{te}")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment