I've been looking around the web for a way to unit test my processor and initializer. So far, I have the following code setup from another article, yet I'm a bit lost in how to proceed.
public class TelemetryClientTests
{
private TelemetryClient telemetryClient;
private List<ITelemetry> sendItems;
[TestInitialize]
public void TestInit()
{
var httpContext = Substitute.For<IHttpContextAccessor>();
var configuration = new TelemetryConfiguration();
//this.sendItems = new List<ITelemetry>();
configuration.TelemetryChannel = new RequeteTelemtry();
configuration.InstrumentationKey = Guid.NewGuid().ToString();
configuration.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
this.telemetryClient = new TelemetryClient(configuration);
}
/// <summary>
/// Ensure that context being propagated via async/await.
/// </summary>
[TestMethod]
public void ContextPropogatesThruAsyncAwait()
{
var task = this.TestAsync();
task.Wait();
}
}
I'm not sure where I should add my telemtryprocessor so that Application Inisight knows that I'm unit testing it. If anybody knows how to do it, it would be greatly appreciated.