public void VerifyIncompleteParameterAtTheEnd(string inputData, bool isPositional) { var predictionContext = PredictionContext.Create(inputData); var commandAst = predictionContext.RelatedAsts.OfType <CommandAst>().LastOrDefault(); var expected = new List <Parameter>() { new Parameter("Name", "Test", isPositional), }; var parameterSet = new ParameterSet(commandAst, _azContext); Assert.Equal(expected, parameterSet.Parameters); }
public void VerifyOnlyParameterName() { var predictionContext = PredictionContext.Create("Get-AzKeyVault -VaultName"); var commandAst = predictionContext.RelatedAsts.OfType <CommandAst>().LastOrDefault(); var expected = new List <Parameter>() { new Parameter("VaultName", null, false), }; var parameterSet = new ParameterSet(commandAst, _azContext); Assert.Equal(expected, parameterSet.Parameters); }
public void VerifyOnlyOnePositionalParameter() { var predictionContext = PredictionContext.Create("Get-AzResourceGroup Test"); var commandAst = predictionContext.RelatedAsts.OfType <CommandAst>().LastOrDefault(); var expected = new List <Parameter>() { new Parameter("Name", "Test", true), }; var parameterSet = new ParameterSet(commandAst, _azContext); Assert.Equal(expected, parameterSet.Parameters); }
public void VerifySwitchParameterAtTheEnd() { var predictionContext = PredictionContext.Create("Get-AzContext -ListAvailable"); var commandAst = predictionContext.RelatedAsts.OfType <CommandAst>().LastOrDefault(); var expected = new List <Parameter>() { new Parameter("ListAvailable", null, false), }; var parameterSet = new ParameterSet(commandAst, _azContext); Assert.Equal(expected, parameterSet.Parameters); }
public void VerifyOneCompleteNamedParameters(string inputData) { var predictionContext = PredictionContext.Create(inputData); var commandAst = predictionContext.RelatedAsts.OfType <CommandAst>().LastOrDefault(); var expected = new List <Parameter>() { new Parameter("Name", "test", false), }; var parameterSet = new ParameterSet(commandAst, _azContext); Assert.Equal(expected, parameterSet.Parameters); }
public void VerifyParameterValues() { var predictionContext = PredictionContext.Create("Get-AzContext"); Action actual = () => this._service.GetSuggestion(null, 1, 1, CancellationToken.None); Assert.Throws <ArgumentNullException>(actual); actual = () => this._service.GetSuggestion(predictionContext, 0, 1, CancellationToken.None); Assert.Throws <ArgumentOutOfRangeException>(actual); actual = () => this._service.GetSuggestion(predictionContext, 1, 0, CancellationToken.None); Assert.Throws <ArgumentOutOfRangeException>(actual); }
public void VerifyTwoCompleteNamedParameters() { var predictionContext = PredictionContext.Create("Get-AzResourceGroup -Name test -Location:WestUs2"); var commandAst = predictionContext.RelatedAsts.OfType <CommandAst>().LastOrDefault(); var expected = new List <Parameter>() { new Parameter("Name", "test", false), new Parameter("Location", "WestUs2", false), }; var parameterSet = new ParameterSet(commandAst, _azContext); Assert.Equal(expected, parameterSet.Parameters); }
public void VerifyPositionalParametersFollowedBySwitchParameters() { var predictionContext = PredictionContext.Create("Get-AzResourceGroup Test $Location -Pre"); var commandAst = predictionContext.RelatedAsts.OfType <CommandAst>().LastOrDefault(); var expected = new List <Parameter>() { new Parameter("Name", "Test", true), new Parameter("Location", "$Location", true), new Parameter("Pre", null, false), }; var parameterSet = new ParameterSet(commandAst, _azContext); Assert.Equal(expected, parameterSet.Parameters); }
public void VerifyNoPrediction(string userInput) { var predictionContext = PredictionContext.Create(userInput); var actual = this._service.GetSuggestion(predictionContext, 1, 1, CancellationToken.None); Assert.Equal(0, actual.Count); actual = this._noFallbackPredictorService.GetSuggestion(predictionContext, 1, 1, CancellationToken.None); Assert.Equal(0, actual.Count); actual = this._noCommandBasedPredictorService.GetSuggestion(predictionContext, 1, 1, CancellationToken.None); Assert.Equal(0, actual.Count); actual = this._noPredictorService.GetSuggestion(predictionContext, 1, 1, CancellationToken.None); Assert.Null(actual); }
public void VerifySuggestionOnIncompleteCommand() { // We need to get the suggestions for more than one. So we create a local version az predictor. var localAzPredictor = new AzPredictor(this._service, this._telemetryClient, new Settings() { SuggestionCount = 7, }, null); var userInput = "New-AzResourceGroup -Name 'ResourceGroup01' -Location 'Central US' -WhatIf -"; var expected = "New-AzResourceGroup -Name 'ResourceGroup01' -Location 'Central US' -WhatIf -Verbose ***"; var predictionContext = PredictionContext.Create(userInput); var actual = localAzPredictor.GetSuggestion(predictionContext, CancellationToken.None); Assert.Equal(expected, actual.First().SuggestionText); }
[InlineData("Get-AzContext Name")] // a wrong command public void GetNoPredictionWithCommandNameParameters(string userInput) { var predictionContext = PredictionContext.Create(userInput); var commandAst = predictionContext.InputAst.FindAll(p => p is CommandAst, true).LastOrDefault() as CommandAst; var commandName = (commandAst?.CommandElements?.FirstOrDefault() as StringConstantExpressionAst)?.Value; var inputParameterSet = new ParameterSet(commandAst, _azContext); var rawUserInput = predictionContext.InputAst.Extent.Text; var presentCommands = new Dictionary <string, int>(); var result = this._predictor.GetSuggestion(commandName, inputParameterSet, rawUserInput, presentCommands, 1, 1, CancellationToken.None); Assert.Equal(0, result.Count); }
public void VerifyPredictionForCommandAndNamedParameters() { var predictionContext = PredictionContext.Create("GET-AZSTORAGEACCOUNTKEY -NAME"); var commandAst = predictionContext.InputAst.FindAll(p => p is CommandAst, true).LastOrDefault() as CommandAst; var commandName = (commandAst?.CommandElements?.FirstOrDefault() as StringConstantExpressionAst)?.Value; var inputParameterSet = new ParameterSet(commandAst, _azContext); var rawUserInput = predictionContext.InputAst.Extent.Text; var presentCommands = new Dictionary <string, int>(); var result = this._predictor.GetSuggestion(commandName, inputParameterSet, rawUserInput, presentCommands, 1, 1, CancellationToken.None); Assert.Equal("Get-AzStorageAccountKey -Name 'myStorageAccount' -ResourceGroupName 'ContosoGroup02'", result.PredictiveSuggestions.First().SuggestionText); }
public void VerifyPredictionForCommand() { var predictionContext = PredictionContext.Create("Connect-AzAccount"); var commandAst = predictionContext.InputAst.FindAll(p => p is CommandAst, true).LastOrDefault() as CommandAst; var commandName = (commandAst?.CommandElements?.FirstOrDefault() as StringConstantExpressionAst)?.Value; var inputParameterSet = new ParameterSet(commandAst, _azContext); var rawUserInput = predictionContext.InputAst.Extent.Text; var presentCommands = new Dictionary <string, int>(); var result = this._predictor.GetSuggestion(commandName, inputParameterSet, rawUserInput, presentCommands, 1, 1, CancellationToken.None); Assert.Equal("Connect-AzAccount -Identity", result.PredictiveSuggestions.First().SuggestionText); }
public void VerifySuggestionOnIncompleteCommand() { // We need to get the suggestions for more than one. So we create a local version az predictor. using var localAzPredictor = new AzPredictor(_service, _telemetryClient, new Settings() { SuggestionCount = 7, MaxAllowedCommandDuplicate = 1, }, null); var userInput = "New-AzResourceGroup -Name 'ResourceGroup01' -Location 'Central US' -WhatIf -"; var expected = "New-AzResourceGroup -Name 'ResourceGroup01' -Location 'Central US' -WhatIf -Tag value1"; var predictionContext = PredictionContext.Create(userInput); var actual = localAzPredictor.GetSuggestion(MockObjects.PredictionClient, predictionContext, CancellationToken.None); Assert.Equal(expected, actual.SuggestionEntries.First().SuggestionText); }
public void VerifyExceptionInGetSuggestion() { var expectedTelemetryCount = 1; var(azPredictor, telemetryClient) = CreateTestObjects(throwException: true, expectedTelemetryCount + 1); var predictionContext = PredictionContext.Create("New-AzResourceGroup -Name 'ResourceGroup01' -Location 'Central US' -WhatIf"); var suggestionPackage = azPredictor.GetSuggestion(AzPredictorTelemetryTests.AzPredictorClient, predictionContext, CancellationToken.None); Assert.IsType <MockTestException>(telemetryClient.GetSuggestionData.Exception); Assert.Equal(AzPredictorTelemetryTests.AzPredictorClient, telemetryClient.GetSuggestionData.ClientId); VerifyTelemetryRecordCount(expectedTelemetryCount, telemetryClient); Assert.EndsWith("GetSuggestion", telemetryClient.RecordedTelemetry[0].EventName); Assert.Equal(AzPredictorTelemetryTests.AzPredictorClient, telemetryClient.RecordedTelemetry[0].Properties["ClientId"]); Assert.Equal("New-AzResourceGroup -Location *** -Name *** -WhatIf ***", telemetryClient.RecordedTelemetry[0].Properties["UserInput"]); Assert.StartsWith($"Type: {typeof(MockTestException)}\nStack Trace: ", telemetryClient.RecordedTelemetry[0].Properties["Exception"]); }
public void VerifySuggestionSessionIdChanged() { var expectedTelemetryCount = 2; var(azPredictor, telemetryClient) = CreateTestObjects(throwException: false, expectedTelemetryCount + 1); var predictionContext = PredictionContext.Create("New-AzResourceGroup -Name 'ResourceGroup01' -Location 'Central US' -WhatIf"); var firstSuggestionPackage = azPredictor.GetSuggestion(AzPredictorTelemetryTests.AzPredictorClient, predictionContext, CancellationToken.None); var firstGetSuggestionData = telemetryClient.GetSuggestionData; var secondSuggestionPackage = azPredictor.GetSuggestion(AzPredictorTelemetryTests.AzPredictorClient, predictionContext, CancellationToken.None); var secondGetSuggestionData = telemetryClient.GetSuggestionData; Assert.NotEqual(secondSuggestionPackage.Session, firstSuggestionPackage.Session); AzPredictorTelemetryTests.EnsureSameCorrelationId(secondGetSuggestionData, firstGetSuggestionData); AzPredictorTelemetryTests.EnsureSameSessionId(secondGetSuggestionData, firstGetSuggestionData); VerifyTelemetryRecordCount(expectedTelemetryCount, telemetryClient); }
public void VerifyUsingFallbackPredictor(string userInput) { var predictionContext = PredictionContext.Create(userInput); var commandAst = predictionContext.RelatedAsts.OfType <CommandAst>().LastOrDefault(); var commandName = (commandAst?.CommandElements?.FirstOrDefault() as StringConstantExpressionAst)?.Value; var inputParameterSet = new ParameterSet(commandAst, _azContext); var rawUserInput = predictionContext.InputAst.Extent.Text; var presentCommands = new Dictionary <string, int>(); var expected = this._fallbackPredictor.GetSuggestion(commandName, inputParameterSet, rawUserInput, presentCommands, 1, 1, CancellationToken.None); var actual = this._service.GetSuggestion(predictionContext, 1, 1, CancellationToken.None); Assert.NotNull(actual); Assert.True(actual.Count > 0); Assert.NotNull(actual.PredictiveSuggestions.First()); Assert.NotNull(actual.PredictiveSuggestions.First().SuggestionText); Assert.Equal(expected.Count, actual.Count); Assert.Equal <PredictiveSuggestion>(expected.PredictiveSuggestions, actual.PredictiveSuggestions, new PredictiveSuggestionComparer()); Assert.Equal <string>(expected.SourceTexts, actual.SourceTexts); Assert.All <SuggestionSource>(actual.SuggestionSources, (source) => Assert.Equal(SuggestionSource.StaticCommands, source)); actual = this._noCommandBasedPredictorService.GetSuggestion(predictionContext, 1, 1, CancellationToken.None); Assert.NotNull(actual); Assert.True(actual.Count > 0); Assert.NotNull(actual.PredictiveSuggestions.First()); Assert.NotNull(actual.PredictiveSuggestions.First().SuggestionText); Assert.Equal(expected.Count, actual.Count); Assert.Equal <PredictiveSuggestion>(expected.PredictiveSuggestions, actual.PredictiveSuggestions, new PredictiveSuggestionComparer()); Assert.Equal <string>(expected.SourceTexts, actual.SourceTexts); Assert.All <SuggestionSource>(actual.SuggestionSources, (source) => Assert.Equal(SuggestionSource.StaticCommands, source)); }
public void VerifyPredictionForCommandAndTwoPositionalParameters() { var predictionContext = PredictionContext.Create("Get-AzStorageAccount test test"); // Two positional parameters with the same value. var commandAst = predictionContext.InputAst.FindAll(p => p is CommandAst, true).LastOrDefault() as CommandAst; var commandName = (commandAst?.CommandElements?.FirstOrDefault() as StringConstantExpressionAst)?.Value; var inputParameterSet = new ParameterSet(commandAst, _azContext); var rawUserInput = predictionContext.InputAst.Extent.Text; var presentCommands = new Dictionary <string, int>(); var result = this._predictor.GetSuggestion(commandName, inputParameterSet, rawUserInput, presentCommands, 3, 1, CancellationToken.None); var expected = new PredictiveSuggestion[] { new PredictiveSuggestion("Get-AzStorageAccount test test -DefaultProfile {IAzureContextContainer}"), new PredictiveSuggestion("Get-AzStorageAccount test test -IncludeGeoReplicationStats"), }; Assert.Equal(expected.Select(e => e.SuggestionText), result.PredictiveSuggestions.Select(r => r.SuggestionText)); }
/// <summary> /// Verify that GetSuggestion, SuggestionDisplayed, and SessionAccepted all have the same suggestion session id. /// </summary> //[Fact] private void VerifySameSuggestionSessionId() { var expectedTelemetryCount = 1; var(azPredictor, telemetryClient) = CreateTestObjects(throwException: false, expectedTelemetryCount + 1); var predictionContext = PredictionContext.Create("New-AzResourceGroup -Name 'ResourceGroup01' -Location 'Central US' -WhatIf"); var suggestionPackage = azPredictor.GetSuggestion(AzPredictorTelemetryTests.AzPredictorClient, predictionContext, CancellationToken.None); Assert.Equal(AzPredictorTelemetryTests.AzPredictorClient, telemetryClient.GetSuggestionData.ClientId); Assert.Equal(suggestionPackage.Session.Value, telemetryClient.GetSuggestionData.SuggestionSessionId); Assert.NotNull(telemetryClient.GetSuggestionData.Suggestion); Assert.NotNull(telemetryClient.GetSuggestionData.UserInput); VerifyTelemetryRecordCount(expectedTelemetryCount, telemetryClient); Assert.EndsWith("GetSuggestion", telemetryClient.RecordedTelemetry[0].EventName); Assert.Equal(AzPredictorTelemetryTests.AzPredictorClient, telemetryClient.RecordedTelemetry[0].Properties["ClientId"]); Assert.Equal(suggestionPackage.Session.Value.ToString(CultureInfo.InvariantCulture), telemetryClient.RecordedTelemetry[0].Properties["SuggestionSessionId"]); Assert.Equal("New-AzResourceGroup -Location *** -Name *** -WhatIf ***", telemetryClient.RecordedTelemetry[0].Properties["UserInut"]); Assert.Equal("", telemetryClient.RecordedTelemetry[0].Properties["Suggestion"]); var displayCountOrIndex = 3; telemetryClient.ResetWaitingTasks(); telemetryClient.ExceptedTelemetryRecordCount = expectedTelemetryCount + 1; azPredictor.OnSuggestionDisplayed(AzPredictorTelemetryTests.AzPredictorClient, suggestionPackage.Session.Value, displayCountOrIndex); VerifyTelemetryRecordCount(expectedTelemetryCount, telemetryClient); Assert.EndsWith("DisplaySuggestion", telemetryClient.RecordedTelemetry[0].EventName); Assert.Equal(suggestionPackage.Session.Value.ToString(CultureInfo.InvariantCulture), telemetryClient.RecordedTelemetry[0].Properties["SuggestionSessionId"]); Assert.Equal(AzPredictorTelemetryTests.AzPredictorClient, telemetryClient.SuggestionDisplayedData.ClientId); Assert.Equal("ListView", telemetryClient.RecordedTelemetry[0].Properties["SuggestionDisplayMode"]); Assert.Equal(displayCountOrIndex.ToString(CultureInfo.InvariantCulture), telemetryClient.RecordedTelemetry[0].Properties["SuggestionCount"]); Assert.False(telemetryClient.RecordedTelemetry[0].Properties.ContainsKey("SuggestionIndex")); var acceptedSuggestion = "SuggestionAccepted"; telemetryClient.ResetWaitingTasks(); telemetryClient.ExceptedTelemetryRecordCount = expectedTelemetryCount + 1; azPredictor.OnSuggestionAccepted(AzPredictorTelemetryTests.AzPredictorClient, suggestionPackage.Session.Value, acceptedSuggestion); VerifyTelemetryRecordCount(expectedTelemetryCount, telemetryClient); Assert.EndsWith("AcceptSuggestion", telemetryClient.RecordedTelemetry[0].EventName); Assert.Equal(AzPredictorTelemetryTests.AzPredictorClient, telemetryClient.RecordedTelemetry[0].Properties["ClientId"]); Assert.Equal(suggestionPackage.Session.Value.ToString(CultureInfo.InvariantCulture), telemetryClient.RecordedTelemetry[0].Properties["SuggestionSessionId"]); Assert.Equal(acceptedSuggestion, telemetryClient.RecordedTelemetry[0].Properties["AccepedSuggestion"]); Assert.Equal(suggestionPackage.Session.Value, telemetryClient.SuggestionDisplayedData.SuggestionSessionId); Assert.Equal(displayCountOrIndex, telemetryClient.SuggestionDisplayedData.SuggestionCountOrIndex); Assert.Equal(suggestionPackage.Session.Value, telemetryClient.SuggestionAcceptedData.SuggestionSessionId); Assert.Equal(acceptedSuggestion, telemetryClient.SuggestionAcceptedData.Suggestion); AzPredictorTelemetryTests.EnsureSameCorrelationId(telemetryClient.GetSuggestionData, telemetryClient.SuggestionDisplayedData); AzPredictorTelemetryTests.EnsureSameCorrelationId(telemetryClient.GetSuggestionData, telemetryClient.SuggestionAcceptedData); AzPredictorTelemetryTests.EnsureSameSessionId(telemetryClient.GetSuggestionData, telemetryClient.SuggestionDisplayedData); AzPredictorTelemetryTests.EnsureSameSessionId(telemetryClient.GetSuggestionData, telemetryClient.SuggestionAcceptedData); Assert.Null(telemetryClient.HistoryData); Assert.Null(telemetryClient.RequestPredictionData); }
public void VerifyParameterValues() { var predictionContext = PredictionContext.Create("Get-AzContext"); var commandAst = predictionContext.InputAst.FindAll(p => p is CommandAst, true).LastOrDefault() as CommandAst; var commandName = (commandAst?.CommandElements?.FirstOrDefault() as StringConstantExpressionAst)?.Value; var inputParameterSet = new ParameterSet(commandAst, _azContext); var rawUserInput = predictionContext.InputAst.Extent.Text; var presentCommands = new Dictionary <string, int>(); Action actual = () => this._predictor.GetSuggestion(null, inputParameterSet, rawUserInput, presentCommands, 1, 1, CancellationToken.None); Assert.Throws <ArgumentException>(actual); actual = () => this._predictor.GetSuggestion(commandName, null, rawUserInput, presentCommands, 1, 1, CancellationToken.None); Assert.Throws <ArgumentNullException>(actual); actual = () => this._predictor.GetSuggestion(commandName, inputParameterSet, null, presentCommands, 1, 1, CancellationToken.None); Assert.Throws <ArgumentException>(actual); actual = () => this._predictor.GetSuggestion(commandName, inputParameterSet, rawUserInput, null, 1, 1, CancellationToken.None); Assert.Throws <ArgumentNullException>(actual); actual = () => this._predictor.GetSuggestion(commandName, inputParameterSet, rawUserInput, presentCommands, 0, 1, CancellationToken.None); Assert.Throws <ArgumentOutOfRangeException>(actual); actual = () => this._predictor.GetSuggestion(commandName, inputParameterSet, rawUserInput, presentCommands, 1, 0, CancellationToken.None); Assert.Throws <ArgumentOutOfRangeException>(actual); }
public static void RegisterSubsystem() { try { Assert.Throws <ArgumentNullException>( paramName: "proxy", () => SubsystemManager.RegisterSubsystem <ICommandPredictor, MyPredictor>(null)); Assert.Throws <ArgumentNullException>( paramName: "proxy", () => SubsystemManager.RegisterSubsystem(SubsystemKind.CommandPredictor, null)); Assert.Throws <ArgumentException>( paramName: "proxy", () => SubsystemManager.RegisterSubsystem((SubsystemKind)0, predictor1)); // Register 'predictor1' SubsystemManager.RegisterSubsystem <ICommandPredictor, MyPredictor>(predictor1); // Now validate the SubsystemInfo of the 'ICommandPredictor' subsystem SubsystemInfo ssInfo = SubsystemManager.GetSubsystemInfo(typeof(ICommandPredictor)); SubsystemInfo crossPlatformDscInfo = SubsystemManager.GetSubsystemInfo(typeof(ICrossPlatformDsc)); VerifyCommandPredictorMetadata(ssInfo); Assert.True(ssInfo.IsRegistered); Assert.Single(ssInfo.Implementations); // Now validate the 'ImplementationInfo' var implInfo = ssInfo.Implementations[0]; Assert.Equal(predictor1.Id, implInfo.Id); Assert.Equal(predictor1.Name, implInfo.Name); Assert.Equal(predictor1.Description, implInfo.Description); Assert.Equal(SubsystemKind.CommandPredictor, implInfo.Kind); Assert.Same(typeof(MyPredictor), implInfo.ImplementationType); // Now validate the subsystem implementation itself. ICommandPredictor impl = SubsystemManager.GetSubsystem <ICommandPredictor>(); Assert.Same(impl, predictor1); Assert.Null(impl.FunctionsToDefine); Assert.Equal(SubsystemKind.CommandPredictor, impl.Kind); const string Client = "SubsystemTest"; const string Input = "Hello world"; var predClient = new PredictionClient(Client, PredictionClientKind.Terminal); var predCxt = PredictionContext.Create(Input); var results = impl.GetSuggestion(predClient, predCxt, CancellationToken.None); Assert.Equal($"'{Input}' from '{Client}' - TEST-1 from {impl.Name}", results.SuggestionEntries[0].SuggestionText); Assert.Equal($"'{Input}' from '{Client}' - TeSt-2 from {impl.Name}", results.SuggestionEntries[1].SuggestionText); // Now validate the all-subsystem-implementation collection. ReadOnlyCollection <ICommandPredictor> impls = SubsystemManager.GetSubsystems <ICommandPredictor>(); Assert.Single(impls); Assert.Same(predictor1, impls[0]); // Register 'predictor2' SubsystemManager.RegisterSubsystem(SubsystemKind.CommandPredictor, predictor2); // Now validate the SubsystemInfo of the 'ICommandPredictor' subsystem VerifyCommandPredictorMetadata(ssInfo); Assert.True(ssInfo.IsRegistered); Assert.Equal(2, ssInfo.Implementations.Count); // Now validate the new 'ImplementationInfo' implInfo = ssInfo.Implementations[1]; Assert.Equal(predictor2.Id, implInfo.Id); Assert.Equal(predictor2.Name, implInfo.Name); Assert.Equal(predictor2.Description, implInfo.Description); Assert.Equal(SubsystemKind.CommandPredictor, implInfo.Kind); Assert.Same(typeof(MyPredictor), implInfo.ImplementationType); // Now validate the new subsystem implementation. impl = SubsystemManager.GetSubsystem <ICommandPredictor>(); Assert.Same(impl, predictor2); // Now validate the all-subsystem-implementation collection. impls = SubsystemManager.GetSubsystems <ICommandPredictor>(); Assert.Equal(2, impls.Count); Assert.Same(predictor1, impls[0]); Assert.Same(predictor2, impls[1]); } finally { SubsystemManager.UnregisterSubsystem <ICommandPredictor>(predictor1.Id); SubsystemManager.UnregisterSubsystem(SubsystemKind.CommandPredictor, predictor2.Id); } }
public void VerifyFailToParseUserInput(string userInput) { var predictionContext = PredictionContext.Create(userInput); Assert.Throws <CommandLineException>(() => _service.GetSuggestion(predictionContext, 1, 1, CancellationToken.None)); }