public void CreateMutateJob() { 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); CreateMutateJobRequest request = new CreateMutateJobRequest { CustomerId = "customer_id3b3724cb", }; CreateMutateJobResponse expectedResponse = new CreateMutateJobResponse { ResourceName = "resource_name8cc2e687", }; mockGrpcClient.Setup(x => x.CreateMutateJob(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); MutateJobServiceClient client = new MutateJobServiceClientImpl(mockGrpcClient.Object, null); CreateMutateJobResponse response = client.CreateMutateJob(request.CustomerId); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void CreateMutateJob2() { Mock <MutateJobService.MutateJobServiceClient> mockGrpcClient = new Mock <MutateJobService.MutateJobServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); CreateMutateJobRequest request = new CreateMutateJobRequest { CustomerId = "customerId-1772061412", }; CreateMutateJobResponse expectedResponse = new CreateMutateJobResponse { ResourceName = "resourceName979421212", }; mockGrpcClient.Setup(x => x.CreateMutateJob(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); MutateJobServiceClient client = new MutateJobServiceClientImpl(mockGrpcClient.Object, null); CreateMutateJobResponse response = client.CreateMutateJob(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }