Example #1
0
        public void UpdateIntent3()
        {
            Mock <Intents.IntentsClient> mockGrpcClient = new Mock <Intents.IntentsClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            UpdateIntentRequest request = new UpdateIntentRequest
            {
                Intent       = new Intent(),
                LanguageCode = "languageCode-412800396",
            };
            Intent expectedResponse = new Intent
            {
                IntentName               = new IntentName("[PROJECT]", "[INTENT]"),
                DisplayName              = "displayName1615086568",
                Priority                 = 1165461084,
                IsFallback               = false,
                MlDisabled               = true,
                Action                   = "action-1422950858",
                ResetContexts            = true,
                RootFollowupIntentName   = "rootFollowupIntentName402253784",
                ParentFollowupIntentName = "parentFollowupIntentName-1131901680",
            };

            mockGrpcClient.Setup(x => x.UpdateIntent(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            IntentsClient client   = new IntentsClientImpl(mockGrpcClient.Object, null);
            Intent        response = client.UpdateIntent(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateIntentRequestObject()
        {
            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.UpdateIntent(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            IntentsClient client   = new IntentsClientImpl(mockGrpcClient.Object, null);
            Intent        response = client.UpdateIntent(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }