@@ -54,6 +54,7 @@ public AzPredictorTelemetryTests(ModelFixture modelFixture)
54
54
[ InlineData ( @"C:\Users\MyName\exe param" ) ]
55
55
[ InlineData ( @"C:\Users\MyName\exe" ) ]
56
56
[ InlineData ( @"az storage" ) ]
57
+ [ InlineData ( @"get" ) ]
57
58
public async Task VerifyOnCommandLineAcceptedForOneUnsupportedCommandHistory ( string inputData )
58
59
{
59
60
var expectedTelemetryCount = 2 ;
@@ -551,7 +552,12 @@ public async Task VerifyOnCommandLineAcceptedException()
551
552
[ InlineData ( "Get-AzContext" , "Get-AzContext" ) ]
552
553
[ InlineData ( "Get-AzResourceGroup -Location *** -Name ***" , "Get-AzResourceGroup -Location westus2 -Name rg1" ) ]
553
554
[ InlineData ( "Get-AzResourceGroup -Location ***" , "Get-AzResourceGroup rg1 -Location westus2" ) ]
554
- [ InlineData ( "Get-AzResourceGroup" , "Get-AzResourceGroup rg1 westus2" ) ]
555
+ [ InlineData ( "get-azresourcegroup" , "get-azresourcegroup rg1 westus2" ) ]
556
+ [ InlineData ( "Set-Az" , "Set-Az" ) ]
557
+ [ InlineData ( "Get-azR" , "Get-azR" ) ]
558
+ [ InlineData ( "start_of_snippet" , "NonVerb-AzResource" ) ]
559
+ [ InlineData ( "start_of_snippet" , "Get" ) ]
560
+ [ InlineData ( "start_of_snippet" , "Set-" ) ]
555
561
public void VerifyUserInputInGetSuggestionEvent ( string expectedUserInput , string input )
556
562
{
557
563
var expectedTelemetryCount = 1 ;
@@ -564,7 +570,7 @@ public void VerifyUserInputInGetSuggestionEvent(string expectedUserInput, string
564
570
VerifyTelemetryDispatchCount ( expectedTelemetryCount , telemetryClient ) ;
565
571
566
572
Assert . EndsWith ( "Aggregation" , telemetryClient . RecordedTelemetry [ 0 ] . EventName ) ;
567
- var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "Suggestion" ] ) ;
573
+ var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
568
574
Assert . Equal ( expectedUserInput , ( ( JsonElement ) ( suggestionSessions [ 0 ] [ GetSuggestionTelemetryData . PropertyNameUserInput ] ) ) . GetString ( ) ) ;
569
575
}
570
576
@@ -589,7 +595,7 @@ private void VerifySameSuggestionSessionId()
589
595
590
596
Assert . EndsWith ( "Aggregation" , telemetryClient . RecordedTelemetry [ 0 ] . EventName ) ;
591
597
Assert . Equal ( MockObjects . PredictionClient . Name , telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "ClientId" ] ) ;
592
- var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "Suggestion" ] ) ;
598
+ var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
593
599
Assert . Equal ( "Clear-Content -Filter *** -Path ***" , ( ( JsonElement ) ( suggestionSessions [ 0 ] [ GetSuggestionTelemetryData . PropertyNameUserInput ] ) ) . GetString ( ) ) ;
594
600
Assert . Equal ( 1 , ( ( JsonElement ) suggestionSessions [ 0 ] [ GetSuggestionTelemetryData . PropertyNameFound ] ) . GetArrayLength ( ) ) ;
595
601
@@ -604,7 +610,7 @@ private void VerifySameSuggestionSessionId()
604
610
605
611
Assert . EndsWith ( "Aggregation" , telemetryClient . RecordedTelemetry [ 0 ] . EventName ) ;
606
612
Assert . Equal ( MockObjects . PredictionClient . Name , telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "ClientId" ] ) ;
607
- suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "Suggestion" ] ) ;
613
+ suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
608
614
Assert . Equal ( ( int ) SuggestionDisplayMode . ListView , ( ( JsonElement ) suggestionSessions [ 0 ] [ SuggestionDisplayedTelemetryData . PropertyNameDisplayed ] ) [ 0 ] . GetInt32 ( ) ) ;
609
615
Assert . Equal ( Math . Abs ( displayCountOrIndex ) , ( ( JsonElement ) suggestionSessions [ 0 ] [ SuggestionDisplayedTelemetryData . PropertyNameDisplayed ] ) [ 1 ] . GetInt32 ( ) ) ;
610
616
Assert . Equal ( suggestionPackage . Session . Value , ( ( JsonElement ) suggestionSessions [ 0 ] [ GetSuggestionTelemetryData . PropertyNameSuggestionSessionId ] ) . GetUInt32 ( ) ) ;
@@ -622,7 +628,7 @@ private void VerifySameSuggestionSessionId()
622
628
623
629
Assert . EndsWith ( "Aggregation" , telemetryClient . RecordedTelemetry [ 0 ] . EventName ) ;
624
630
Assert . Equal ( MockObjects . PredictionClient . Name , telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "ClientId" ] ) ;
625
- suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "Suggestion" ] ) ;
631
+ suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
626
632
Assert . Equal ( suggestionPackage . Session . Value , ( ( JsonElement ) suggestionSessions [ 0 ] [ GetSuggestionTelemetryData . PropertyNameSuggestionSessionId ] ) . GetUInt32 ( ) ) ;
627
633
Assert . Equal ( acceptedSuggestion , ( ( JsonElement ) suggestionSessions [ 0 ] [ SuggestionAcceptedTelemetryData . PropertyNameAccepted ] ) . GetString ( ) ) ;
628
634
AzPredictorTelemetryTests . EnsureSameRequestId ( telemetryClient . GetSuggestionData , telemetryClient . SuggestionDisplayedData ) ;
@@ -676,7 +682,7 @@ public void VerifyListViewInSuggestionDisplayed()
676
682
677
683
Assert . EndsWith ( "Aggregation" , telemetryClient . RecordedTelemetry [ 0 ] . EventName ) ;
678
684
Assert . Equal ( MockObjects . PredictionClient . Name , telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "ClientId" ] ) ;
679
- var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "Suggestion" ] ) ;
685
+ var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
680
686
Assert . Equal ( ( int ) SuggestionDisplayMode . ListView , ( ( JsonElement ) suggestionSessions [ 0 ] [ SuggestionDisplayedTelemetryData . PropertyNameDisplayed ] ) [ 0 ] . GetInt32 ( ) ) ;
681
687
Assert . Equal ( Math . Abs ( suggestionCountOrIndex ) , ( ( JsonElement ) suggestionSessions [ 0 ] [ SuggestionDisplayedTelemetryData . PropertyNameDisplayed ] ) [ 1 ] . GetInt32 ( ) ) ;
682
688
Assert . Equal ( suggestionSessionId , ( ( JsonElement ) suggestionSessions [ 0 ] [ GetSuggestionTelemetryData . PropertyNameSuggestionSessionId ] ) . GetUInt32 ( ) ) ;
@@ -705,7 +711,7 @@ public void VerifyInlineViewInSuggestionDisplayedAtEdge()
705
711
Assert . EndsWith ( "Aggregation" , telemetryClient . RecordedTelemetry [ 0 ] . EventName ) ;
706
712
Assert . Equal ( MockObjects . PredictionClient . Name , telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "ClientId" ] ) ;
707
713
708
- var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "Suggestion" ] ) ;
714
+ var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
709
715
Assert . Equal ( ( int ) SuggestionDisplayMode . InlineView , ( ( JsonElement ) suggestionSessions [ 0 ] [ SuggestionDisplayedTelemetryData . PropertyNameDisplayed ] ) [ 0 ] . GetInt32 ( ) ) ;
710
716
Assert . Equal ( Math . Abs ( suggestionCountOrIndex ) , ( ( JsonElement ) suggestionSessions [ 0 ] [ SuggestionDisplayedTelemetryData . PropertyNameDisplayed ] ) [ 1 ] . GetInt32 ( ) ) ;
711
717
Assert . Equal ( suggestionSessionId , ( ( JsonElement ) suggestionSessions [ 0 ] [ GetSuggestionTelemetryData . PropertyNameSuggestionSessionId ] ) . GetUInt32 ( ) ) ;
@@ -733,7 +739,7 @@ public void VerifyInlineViewInSuggestionDisplayed()
733
739
734
740
Assert . EndsWith ( "Aggregation" , telemetryClient . RecordedTelemetry [ 0 ] . EventName ) ;
735
741
Assert . Equal ( MockObjects . PredictionClient . Name , telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "ClientId" ] ) ;
736
- var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ "Suggestion" ] ) ;
742
+ var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( telemetryClient . RecordedTelemetry [ 0 ] . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
737
743
Assert . Equal ( ( int ) SuggestionDisplayMode . InlineView , ( ( JsonElement ) suggestionSessions [ 0 ] [ SuggestionDisplayedTelemetryData . PropertyNameDisplayed ] ) [ 0 ] . GetInt32 ( ) ) ;
738
744
Assert . Equal ( Math . Abs ( suggestionCountOrIndex ) , ( ( JsonElement ) suggestionSessions [ 0 ] [ SuggestionDisplayedTelemetryData . PropertyNameDisplayed ] ) [ 1 ] . GetInt32 ( ) ) ;
739
745
}
@@ -928,11 +934,11 @@ public void VerifyAggregationDataSplitAtGetSuggestion()
928
934
telemetryClient . FlushTelemetry ( ) ;
929
935
930
936
var recordedTelemetry = telemetryClient . RecordedTelemetry [ 0 ] ;
931
- var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ "Suggestion" ] ) ;
937
+ var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
932
938
Assert . Equal ( expectedSuggestionSessionInFirstBatch , suggestionSessions . Count ( ) ) ;
933
939
934
940
recordedTelemetry = telemetryClient . RecordedTelemetry [ 1 ] ;
935
- suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ "Suggestion" ] ) ;
941
+ suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
936
942
Assert . Equal ( expectedSuggestionSessionInSecondBatch , suggestionSessions . Count ( ) ) ;
937
943
Assert . True ( suggestionSessions [ 0 ] . ContainsKey ( GetSuggestionTelemetryData . PropertyNameFound ) ) ;
938
944
}
@@ -980,7 +986,7 @@ public void VerifyAggregationDataSplitAtAcceptSuggestion()
980
986
telemetryClient . FlushTelemetry ( ) ;
981
987
982
988
var recordedTelemetry = telemetryClient . RecordedTelemetry [ 0 ] ;
983
- var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ "Suggestion" ] ) ;
989
+ var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
984
990
Assert . Equal ( expectedSuggestionSessionInFirstBatch , suggestionSessions . Count ( ) ) ;
985
991
Assert . True ( suggestionSessions . All ( ( s ) => s . ContainsKey ( GetSuggestionTelemetryData . PropertyNameFound ) && s . ContainsKey ( GetSuggestionTelemetryData . PropertyNameUserInput ) ) ) ;
986
992
Assert . True ( suggestionSessions . All ( ( s ) => ! s . ContainsKey ( SuggestionAcceptedTelemetryData . PropertyNameAccepted ) ) ) ;
@@ -990,7 +996,7 @@ public void VerifyAggregationDataSplitAtAcceptSuggestion()
990
996
Assert . Equal ( 1 , ( ( JsonElement ) suggestionSessions . Last ( ) [ SuggestionDisplayedTelemetryData . PropertyNameDisplayed ] ) [ 1 ] . GetInt32 ( ) ) ;
991
997
992
998
recordedTelemetry = telemetryClient . RecordedTelemetry [ 1 ] ;
993
- suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ "Suggestion" ] ) ;
999
+ suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
994
1000
Assert . Equal ( expectedSuggestionSessionInSecondBatch , suggestionSessions . Count ( ) ) ;
995
1001
Assert . False ( suggestionSessions [ 0 ] . ContainsKey ( GetSuggestionTelemetryData . PropertyNameFound ) ) ;
996
1002
Assert . False ( suggestionSessions [ 0 ] . ContainsKey ( GetSuggestionTelemetryData . PropertyNameUserInput ) ) ;
@@ -1042,7 +1048,7 @@ public void VerifyAggregationDataSplitAtCommandHistory()
1042
1048
VerifyTelemetryDispatchCount ( expectedTelemetryCount , telemetryClient ) ;
1043
1049
1044
1050
var recordedTelemetry = telemetryClient . RecordedTelemetry [ 0 ] ;
1045
- var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ "Suggestion" ] ) ;
1051
+ var suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
1046
1052
Assert . Equal ( expectedSuggestionSessionInFirstBatch , suggestionSessions . Count ( ) ) ;
1047
1053
Assert . True ( suggestionSessions . All ( ( s ) => s . ContainsKey ( GetSuggestionTelemetryData . PropertyNameFound ) && s . ContainsKey ( GetSuggestionTelemetryData . PropertyNameUserInput ) ) ) ;
1048
1054
Assert . True ( suggestionSessions . All ( ( s ) => ! s . ContainsKey ( SuggestionAcceptedTelemetryData . PropertyNameAccepted ) ) ) ;
@@ -1052,7 +1058,7 @@ public void VerifyAggregationDataSplitAtCommandHistory()
1052
1058
Assert . Equal ( 1 , ( ( JsonElement ) suggestionSessions . Last ( ) [ SuggestionDisplayedTelemetryData . PropertyNameDisplayed ] ) [ 1 ] . GetInt32 ( ) ) ;
1053
1059
1054
1060
recordedTelemetry = telemetryClient . RecordedTelemetry [ 1 ] ;
1055
- suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ "Suggestion" ] ) ;
1061
+ suggestionSessions = JsonSerializer . Deserialize < IList < IDictionary < string , object > > > ( recordedTelemetry . Properties [ GetSuggestionTelemetryData . PropertyNamePrediction ] ) ;
1056
1062
Assert . Equal ( expectedSuggestionSessionInSecondBatch , suggestionSessions . Count ( ) ) ;
1057
1063
Assert . False ( suggestionSessions [ 0 ] . ContainsKey ( GetSuggestionTelemetryData . PropertyNameFound ) ) ;
1058
1064
Assert . False ( suggestionSessions [ 0 ] . ContainsKey ( GetSuggestionTelemetryData . PropertyNameUserInput ) ) ;
0 commit comments