Esempio n. 1
0
        public async stt::Task BatchDeleteAlertsRequestObjectAsync()
        {
            moq::Mock <AlertCenterService.AlertCenterServiceClient> mockGrpcClient = new moq::Mock <AlertCenterService.AlertCenterServiceClient>(moq::MockBehavior.Strict);
            BatchDeleteAlertsRequest request = new BatchDeleteAlertsRequest
            {
                CustomerId = "customer_id3b3724cb",
                AlertId    =
                {
                    "alert_idc6c58cd5",
                },
            };
            BatchDeleteAlertsResponse expectedResponse = new BatchDeleteAlertsResponse
            {
                SuccessAlertIds =
                {
                    "success_alert_ids0aeac317",
                },
                FailedAlertStatus =
                {
                    {
                        "key8a0b6e3c",
                        new gr::Status()
                    },
                },
            };

            mockGrpcClient.Setup(x => x.BatchDeleteAlertsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <BatchDeleteAlertsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            AlertCenterServiceClient  client = new AlertCenterServiceClientImpl(mockGrpcClient.Object, null);
            BatchDeleteAlertsResponse responseCallSettings = await client.BatchDeleteAlertsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            BatchDeleteAlertsResponse responseCancellationToken = await client.BatchDeleteAlertsAsync(request, st::CancellationToken.None);

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