-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds projectKind and projectId to PMUIRefresh event (#4981)
Fixes https://github.com/NuGet/Client.Engineering/issues/1997 Adds projectId and projectKind to pmuirefresh event.
- Loading branch information
Fernando Aguilar
authored
Dec 13, 2022
1 parent
0e7accb
commit d3639a5
Showing
5 changed files
with
140 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
50 changes: 50 additions & 0 deletions
50
...et.PackageManagement.VisualStudio.Test/Telemetry/PackageManagerUIRefreshTelemetryTests.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// 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. | ||
|
||
using System; | ||
using Moq; | ||
using NuGet.PackageManagement.Telemetry; | ||
using NuGet.VisualStudio.Internal.Contracts; | ||
using Xunit; | ||
|
||
namespace NuGet.PackageManagement.VisualStudio.Test | ||
{ | ||
public class PackageManagerUIRefreshTelemetryTests | ||
{ | ||
[Fact] | ||
public void ForSolution_SimulatedData_NoProjectKindIfIsSolutionLevelSetToTrue() | ||
{ | ||
var telemetryEvent = PackageManagerUIRefreshEvent.ForSolution( | ||
It.IsAny<Guid>(), | ||
It.IsAny<RefreshOperationSource>(), | ||
It.IsAny<RefreshOperationStatus>(), | ||
tab: It.IsAny<ItemFilter>(), | ||
isUIFiltering: It.IsAny<bool>(), | ||
It.IsAny<TimeSpan>(), | ||
It.IsAny<double?>()); | ||
|
||
Assert.Null(telemetryEvent["ProjectKind"]); | ||
Assert.Null(telemetryEvent["ProjectId"]); | ||
} | ||
|
||
[Fact] | ||
public void ForProject_SimulatedData_ProjectKindAndProjectIdSet() | ||
{ | ||
NuGetProjectKind kind = NuGetProjectKind.PackageReference; | ||
string projectId = "simulated-project-id-Guid"; | ||
var telemetryEvent = PackageManagerUIRefreshEvent.ForProject( | ||
It.IsAny<Guid>(), | ||
It.IsAny<RefreshOperationSource>(), | ||
It.IsAny<RefreshOperationStatus>(), | ||
tab: It.IsAny<ItemFilter>(), | ||
isUIFiltering: It.IsAny<bool>(), | ||
It.IsAny<TimeSpan>(), | ||
It.IsAny<double?>(), | ||
projectId, | ||
kind); | ||
|
||
Assert.NotNull(telemetryEvent["ProjectKind"]); | ||
Assert.NotNull(telemetryEvent["ProjectId"]); | ||
} | ||
} | ||
} |