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();
        }
Пример #2
0
        public async Task DeleteIntentAsync2()
        {
            Mock <Intents.IntentsClient> mockGrpcClient = new Mock <Intents.IntentsClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            DeleteIntentRequest request = new DeleteIntentRequest
            {
                IntentName = new IntentName("[PROJECT]", "[INTENT]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteIntentAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            IntentsClient client = new IntentsClientImpl(mockGrpcClient.Object, null);
            await client.DeleteIntentAsync(request);

            mockGrpcClient.VerifyAll();
        }