public async Task DeleteEventsAsync2()
        {
            Mock <ErrorStatsService.ErrorStatsServiceClient> mockGrpcClient = new Mock <ErrorStatsService.ErrorStatsServiceClient>(MockBehavior.Strict);
            DeleteEventsRequest request = new DeleteEventsRequest
            {
                ProjectNameAsProjectName = new ProjectName("[PROJECT]"),
            };
            DeleteEventsResponse expectedResponse = new DeleteEventsResponse();

            mockGrpcClient.Setup(x => x.DeleteEventsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <DeleteEventsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            ErrorStatsServiceClient client   = new ErrorStatsServiceClientImpl(mockGrpcClient.Object, null);
            DeleteEventsResponse    response = await client.DeleteEventsAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #2
0
        public void DeleteEvents()
        {
            moq::Mock <ErrorStatsService.ErrorStatsServiceClient> mockGrpcClient = new moq::Mock <ErrorStatsService.ErrorStatsServiceClient>(moq::MockBehavior.Strict);
            DeleteEventsRequest request = new DeleteEventsRequest
            {
                ProjectNameAsProjectName = new gagr::ProjectName("[PROJECT]"),
            };
            DeleteEventsResponse expectedResponse = new DeleteEventsResponse {
            };

            mockGrpcClient.Setup(x => x.DeleteEvents(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ErrorStatsServiceClient client   = new ErrorStatsServiceClientImpl(mockGrpcClient.Object, null);
            DeleteEventsResponse    response = client.DeleteEvents(request.ProjectName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void DeleteEvents2()
        {
            Mock <ErrorStatsService.ErrorStatsServiceClient> mockGrpcClient = new Mock <ErrorStatsService.ErrorStatsServiceClient>(MockBehavior.Strict);
            DeleteEventsRequest request = new DeleteEventsRequest
            {
                ProjectNameAsProjectName = new ProjectName("[PROJECT]"),
            };
            DeleteEventsResponse expectedResponse = new DeleteEventsResponse();

            mockGrpcClient.Setup(x => x.DeleteEvents(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ErrorStatsServiceClient client   = new ErrorStatsServiceClientImpl(mockGrpcClient.Object, null);
            DeleteEventsResponse    response = client.DeleteEvents(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #4
0
        public async stt::Task DeleteEventsAsync()
        {
            moq::Mock <ErrorStatsService.ErrorStatsServiceClient> mockGrpcClient = new moq::Mock <ErrorStatsService.ErrorStatsServiceClient>(moq::MockBehavior.Strict);
            DeleteEventsRequest request = new DeleteEventsRequest
            {
                ProjectNameAsProjectName = new gagr::ProjectName("[PROJECT]"),
            };
            DeleteEventsResponse expectedResponse = new DeleteEventsResponse {
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            DeleteEventsResponse responseCancellationToken = await client.DeleteEventsAsync(request.ProjectName, st::CancellationToken.None);

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