Implemented Telemetry class via an interface for test ease

This commit is contained in:
Lakshan Fernando 2016-03-31 16:37:40 -07:00 committed by Dan Quirk
parent d9e169e77a
commit 25745d9d4e
4 changed files with 75 additions and 20 deletions

View file

@ -26,14 +26,13 @@ namespace Microsoft.DotNet.Cli
{
public class Program
{
public static int Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
try
{
return ProcessArgs(args);
return new Program().ProcessArgs(args, new Telemetry());
}
catch (CommandUnknownException e)
{
@ -44,7 +43,7 @@ namespace Microsoft.DotNet.Cli
}
private static int ProcessArgs(string[] args)
public int ProcessArgs(string[] args, ITelemetry telemetryClient)
{
// CommandLineApplication is a bit restrictive, so we parse things ourselves here. Individual apps should use CLA.
@ -135,10 +134,9 @@ namespace Microsoft.DotNet.Cli
exitCode = result.ExitCode;
}
Telemetry telemetryClient = new Telemetry();
telemetryClient.TrackCommand(
telemetryClient.TrackEvent(
command,
null,
new Dictionary<string, double>
{
["ExitCode"] = exitCode