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

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

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

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