public async stt::Task MatchIntentRequestObjectAsync() { moq::Mock <Sessions.SessionsClient> mockGrpcClient = new moq::Mock <Sessions.SessionsClient>(moq::MockBehavior.Strict); MatchIntentRequest request = new MatchIntentRequest { SessionAsSessionName = SessionName.FromProjectLocationAgentSession("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"), QueryParams = new QueryParameters(), QueryInput = new QueryInput(), }; MatchIntentResponse expectedResponse = new MatchIntentResponse { Text = "textec51b21c", TriggerIntentAsIntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), Transcript = "transcript20c5b28b", Matches = { new Match(), }, CurrentPage = new Page(), TriggerEvent = "trigger_eventff063b42", }; mockGrpcClient.Setup(x => x.MatchIntentAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MatchIntentResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SessionsClient client = new SessionsClientImpl(mockGrpcClient.Object, null); MatchIntentResponse responseCallSettings = await client.MatchIntentAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MatchIntentResponse responseCancellationToken = await client.MatchIntentAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void MatchIntentRequestObject() { moq::Mock <Sessions.SessionsClient> mockGrpcClient = new moq::Mock <Sessions.SessionsClient>(moq::MockBehavior.Strict); MatchIntentRequest request = new MatchIntentRequest { SessionAsSessionName = SessionName.FromProjectLocationAgentSession("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"), QueryParams = new QueryParameters(), QueryInput = new QueryInput(), }; MatchIntentResponse expectedResponse = new MatchIntentResponse { Text = "textec51b21c", TriggerIntentAsIntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), Transcript = "transcript20c5b28b", Matches = { new Match(), }, CurrentPage = new Page(), TriggerEvent = "trigger_eventff063b42", }; mockGrpcClient.Setup(x => x.MatchIntent(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SessionsClient client = new SessionsClientImpl(mockGrpcClient.Object, null); MatchIntentResponse response = client.MatchIntent(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetIntent</summary> public void GetIntentResourceNames() { // Snippet: GetIntent(IntentName, CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) IntentName name = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); // Make the request Intent response = intentsClient.GetIntent(name); // End snippet }
/// <summary>Snippet for DeleteIntentAsync</summary> public async Task DeleteIntentResourceNamesAsync() { // Snippet: DeleteIntentAsync(IntentName, CallSettings) // Additional: DeleteIntentAsync(IntentName, CancellationToken) // Create client IntentsClient intentsClient = await IntentsClient.CreateAsync(); // Initialize request argument(s) IntentName name = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); // Make the request await intentsClient.DeleteIntentAsync(name); // End snippet }
/// <summary>Snippet for DeleteIntent</summary> public void DeleteIntentRequestObject() { // Snippet: DeleteIntent(DeleteIntentRequest, CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) DeleteIntentRequest request = new DeleteIntentRequest { IntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), }; // Make the request intentsClient.DeleteIntent(request); // End snippet }
/// <summary>Snippet for GetIntent</summary> public void GetIntentRequestObject() { // Snippet: GetIntent(GetIntentRequest, CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) GetIntentRequest request = new GetIntentRequest { IntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), LanguageCode = "", }; // Make the request Intent response = intentsClient.GetIntent(request); // End snippet }
public void DeleteIntentResourceNames() { moq::Mock <Intents.IntentsClient> mockGrpcClient = new moq::Mock <Intents.IntentsClient>(moq::MockBehavior.Strict); DeleteIntentRequest request = new DeleteIntentRequest { IntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteIntent(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); IntentsClient client = new IntentsClientImpl(mockGrpcClient.Object, null); client.DeleteIntent(request.IntentName); mockGrpcClient.VerifyAll(); }
public async stt::Task DeleteIntentResourceNamesAsync() { moq::Mock <Intents.IntentsClient> mockGrpcClient = new moq::Mock <Intents.IntentsClient>(moq::MockBehavior.Strict); DeleteIntentRequest request = new DeleteIntentRequest { IntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteIntentAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); IntentsClient client = new IntentsClientImpl(mockGrpcClient.Object, null); await client.DeleteIntentAsync(request.IntentName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteIntentAsync(request.IntentName, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetIntentAsync</summary> public async Task GetIntentRequestObjectAsync() { // Snippet: GetIntentAsync(GetIntentRequest, CallSettings) // Additional: GetIntentAsync(GetIntentRequest, CancellationToken) // Create client IntentsClient intentsClient = await IntentsClient.CreateAsync(); // Initialize request argument(s) GetIntentRequest request = new GetIntentRequest { IntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), LanguageCode = "", }; // Make the request Intent response = await intentsClient.GetIntentAsync(request); // End snippet }
public async stt::Task UpdateIntentRequestObjectAsync() { moq::Mock <Intents.IntentsClient> mockGrpcClient = new moq::Mock <Intents.IntentsClient>(moq::MockBehavior.Strict); UpdateIntentRequest request = new UpdateIntentRequest { Intent = new Intent(), LanguageCode = "language_code2f6c7160", UpdateMask = new wkt::FieldMask(), }; Intent expectedResponse = new Intent { IntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), DisplayName = "display_name137f65c2", TrainingPhrases = { new Intent.Types.TrainingPhrase(), }, Parameters = { new Intent.Types.Parameter(), }, Priority = 1546225849, IsFallback = true, Labels = { { "key8a0b6e3c", "value60c16320" }, }, Description = "description2cf9da67", }; mockGrpcClient.Setup(x => x.UpdateIntentAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Intent>(stt::Task.FromResult(expectedResponse), null, null, null, null)); IntentsClient client = new IntentsClientImpl(mockGrpcClient.Object, null); Intent responseCallSettings = await client.UpdateIntentAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Intent responseCancellationToken = await client.UpdateIntentAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void CreateIntentRequestObject() { moq::Mock <Intents.IntentsClient> mockGrpcClient = new moq::Mock <Intents.IntentsClient>(moq::MockBehavior.Strict); CreateIntentRequest request = new CreateIntentRequest { ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"), Intent = new Intent(), LanguageCode = "language_code2f6c7160", }; Intent expectedResponse = new Intent { IntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), DisplayName = "display_name137f65c2", TrainingPhrases = { new Intent.Types.TrainingPhrase(), }, Parameters = { new Intent.Types.Parameter(), }, Priority = 1546225849, IsFallback = true, Labels = { { "key8a0b6e3c", "value60c16320" }, }, Description = "description2cf9da67", }; mockGrpcClient.Setup(x => x.CreateIntent(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); IntentsClient client = new IntentsClientImpl(mockGrpcClient.Object, null); Intent response = client.CreateIntent(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }