Installer Success Reporting for Windows

Issue https://github.com/dotnet/cli/issues/7091

Add internal command dotnet internal-reportinstallsuccess. Before
Windows installer finishes, run this command instead of dotnet new. It
will trigger the first time experience as well as sending telemetry with
installer exe name.

This command blocks to ensure that the webservice call completes.
This commit is contained in:
William Li 2017-06-27 13:46:09 -07:00 committed by William Lee
parent 44cd1cf385
commit 191e3e3019
8 changed files with 119 additions and 5 deletions

View file

@ -17,14 +17,15 @@ namespace Microsoft.DotNet.Tests
public bool Enabled { get; set; }
public string EventName { get; set; }
public IDictionary<string, string> Properties { get; set; }
public void TrackEvent(string eventName, IDictionary<string, string> properties, IDictionary<string, double> measurements)
{
EventName = eventName;
Properties = properties;
}
}
public class TelemetryCommandTests : TestBase
{
[Fact]
@ -35,5 +36,23 @@ namespace Microsoft.DotNet.Tests
Microsoft.DotNet.Cli.Program.ProcessArgs(args, mockTelemetry);
Assert.Equal(mockTelemetry.EventName, args[0]);
}
[Fact]
public void InternalreportinstallsuccessCommandCollectExeNameWithEventname()
{
MockTelemetry mockTelemetry = new MockTelemetry();
string[] args = { "c:\\mypath\\dotnet-sdk-latest-win-x64.exe" };
InternalReportinstallsuccess.ProcessInputAndSendTelemetry(args, mockTelemetry);
mockTelemetry.EventName.Should().Be("reportinstallsuccess");
mockTelemetry.Properties["exeName"].Should().Be("dotnet-sdk-latest-win-x64.exe");
}
[Fact]
public void InternalreportinstallsuccessCommandIsRegistedInBuiltIn()
{
BuiltInCommandsCatalog.Commands.Should().ContainKey("internal-reportinstallsuccess");
}
}
}