public void MutateCustomInterests() { moq::Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new moq::Mock <CustomInterestService.CustomInterestServiceClient>(moq::MockBehavior.Strict); MutateCustomInterestsRequest request = new MutateCustomInterestsRequest { CustomerId = "customer_id3b3724cb", Operations = { new CustomInterestOperation(), }, }; MutateCustomInterestsResponse expectedResponse = new MutateCustomInterestsResponse { Results = { new MutateCustomInterestResult(), }, }; mockGrpcClient.Setup(x => x.MutateCustomInterests(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CustomInterestServiceClient client = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null); MutateCustomInterestsResponse response = client.MutateCustomInterests(request.CustomerId, request.Operations); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCustomInterests3() { Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new Mock <CustomInterestService.CustomInterestServiceClient>(MockBehavior.Strict); MutateCustomInterestsRequest request = new MutateCustomInterestsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateCustomInterestsResponse expectedResponse = new MutateCustomInterestsResponse(); mockGrpcClient.Setup(x => x.MutateCustomInterests(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); CustomInterestServiceClient client = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null); MutateCustomInterestsResponse response = client.MutateCustomInterests(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCustomInterests() { Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new Mock <CustomInterestService.CustomInterestServiceClient>(MockBehavior.Strict); MutateCustomInterestsRequest expectedRequest = new MutateCustomInterestsRequest { CustomerId = "customerId-1772061412", Operations = { }, ValidateOnly = false, }; MutateCustomInterestsResponse expectedResponse = new MutateCustomInterestsResponse(); mockGrpcClient.Setup(x => x.MutateCustomInterests(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); CustomInterestServiceClient client = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <CustomInterestOperation> operations = new List <CustomInterestOperation>(); bool validateOnly = false; MutateCustomInterestsResponse response = client.MutateCustomInterests(customerId, operations, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }