Пример #1
0
        public async stt::Task AddMutateJobOperations2ResourceNamesAsync()
        {
            moq::Mock <MutateJobService.MutateJobServiceClient> mockGrpcClient = new moq::Mock <MutateJobService.MutateJobServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            AddMutateJobOperationsRequest request = new AddMutateJobOperationsRequest
            {
                ResourceNameAsMutateJobName = gagvr::MutateJobName.FromCustomerMutateJob("[CUSTOMER]", "[MUTATE_JOB]"),
                MutateOperations            =
                {
                    new MutateOperation(),
                },
            };
            AddMutateJobOperationsResponse expectedResponse = new AddMutateJobOperationsResponse
            {
                TotalOperations   = -8188520186954789005L,
                NextSequenceToken = "next_sequence_token160dabc7",
            };

            mockGrpcClient.Setup(x => x.AddMutateJobOperationsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AddMutateJobOperationsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            MutateJobServiceClient         client = new MutateJobServiceClientImpl(mockGrpcClient.Object, null);
            AddMutateJobOperationsResponse responseCallSettings = await client.AddMutateJobOperationsAsync(request.ResourceNameAsMutateJobName, request.MutateOperations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            AddMutateJobOperationsResponse responseCancellationToken = await client.AddMutateJobOperationsAsync(request.ResourceNameAsMutateJobName, request.MutateOperations, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Пример #2
0
        public async Task AddMutateJobOperationsAsync2()
        {
            Mock <MutateJobService.MutateJobServiceClient> mockGrpcClient = new Mock <MutateJobService.MutateJobServiceClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            AddMutateJobOperationsRequest request = new AddMutateJobOperationsRequest
            {
                ResourceName     = new MutateJobName("[CUSTOMER]", "[MUTATE_JOB]").ToString(),
                SequenceToken    = "sequenceToken-868155397",
                MutateOperations = { },
            };
            AddMutateJobOperationsResponse expectedResponse = new AddMutateJobOperationsResponse
            {
                TotalOperations   = 1685086151L,
                NextSequenceToken = "nextSequenceToken388644551",
            };

            mockGrpcClient.Setup(x => x.AddMutateJobOperationsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <AddMutateJobOperationsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            MutateJobServiceClient         client   = new MutateJobServiceClientImpl(mockGrpcClient.Object, null);
            AddMutateJobOperationsResponse response = await client.AddMutateJobOperationsAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #3
0
        public void AddMutateJobOperations2ResourceNames()
        {
            moq::Mock <MutateJobService.MutateJobServiceClient> mockGrpcClient = new moq::Mock <MutateJobService.MutateJobServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            AddMutateJobOperationsRequest request = new AddMutateJobOperationsRequest
            {
                ResourceNameAsMutateJobName = gagvr::MutateJobName.FromCustomerMutateJob("[CUSTOMER]", "[MUTATE_JOB]"),
                MutateOperations            =
                {
                    new MutateOperation(),
                },
            };
            AddMutateJobOperationsResponse expectedResponse = new AddMutateJobOperationsResponse
            {
                TotalOperations   = -8188520186954789005L,
                NextSequenceToken = "next_sequence_token160dabc7",
            };

            mockGrpcClient.Setup(x => x.AddMutateJobOperations(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            MutateJobServiceClient         client   = new MutateJobServiceClientImpl(mockGrpcClient.Object, null);
            AddMutateJobOperationsResponse response = client.AddMutateJobOperations(request.ResourceNameAsMutateJobName, request.MutateOperations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #4
0
        public void AddMutateJobOperations()
        {
            Mock <MutateJobService.MutateJobServiceClient> mockGrpcClient = new Mock <MutateJobService.MutateJobServiceClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            AddMutateJobOperationsRequest expectedRequest = new AddMutateJobOperationsRequest
            {
                ResourceName     = new MutateJobName("[CUSTOMER]", "[MUTATE_JOB]").ToString(),
                SequenceToken    = "sequenceToken-868155397",
                MutateOperations = { },
            };
            AddMutateJobOperationsResponse expectedResponse = new AddMutateJobOperationsResponse
            {
                TotalOperations   = 1685086151L,
                NextSequenceToken = "nextSequenceToken388644551",
            };

            mockGrpcClient.Setup(x => x.AddMutateJobOperations(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            MutateJobServiceClient client = new MutateJobServiceClientImpl(mockGrpcClient.Object, null);
            string formattedResourceName  = new MutateJobName("[CUSTOMER]", "[MUTATE_JOB]").ToString();
            string sequenceToken          = "sequenceToken-868155397";
            IEnumerable <MutateOperation>  mutateOperations = new List <MutateOperation>();
            AddMutateJobOperationsResponse response         = client.AddMutateJobOperations(formattedResourceName, sequenceToken, mutateOperations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }