public void MutateAdGroups() { moq::Mock <AdGroupService.AdGroupServiceClient> mockGrpcClient = new moq::Mock <AdGroupService.AdGroupServiceClient>(moq::MockBehavior.Strict); MutateAdGroupsRequest request = new MutateAdGroupsRequest { CustomerId = "customer_id3b3724cb", Operations = { new AdGroupOperation(), }, }; MutateAdGroupsResponse expectedResponse = new MutateAdGroupsResponse { Results = { new MutateAdGroupResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateAdGroups(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AdGroupServiceClient client = new AdGroupServiceClientImpl(mockGrpcClient.Object, null); MutateAdGroupsResponse response = client.MutateAdGroups(request.CustomerId, request.Operations); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateAdGroupsRequestObject() { moq::Mock <AdGroupService.AdGroupServiceClient> mockGrpcClient = new moq::Mock <AdGroupService.AdGroupServiceClient>(moq::MockBehavior.Strict); MutateAdGroupsRequest request = new MutateAdGroupsRequest { CustomerId = "customer_id3b3724cb", Operations = { new AdGroupOperation(), }, PartialFailure = false, ValidateOnly = true, ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly, }; MutateAdGroupsResponse expectedResponse = new MutateAdGroupsResponse { Results = { new MutateAdGroupResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateAdGroups(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AdGroupServiceClient client = new AdGroupServiceClientImpl(mockGrpcClient.Object, null); MutateAdGroupsResponse response = client.MutateAdGroups(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateAdGroups2() { Mock <AdGroupService.AdGroupServiceClient> mockGrpcClient = new Mock <AdGroupService.AdGroupServiceClient>(MockBehavior.Strict); MutateAdGroupsRequest request = new MutateAdGroupsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateAdGroupsResponse expectedResponse = new MutateAdGroupsResponse(); mockGrpcClient.Setup(x => x.MutateAdGroups(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AdGroupServiceClient client = new AdGroupServiceClientImpl(mockGrpcClient.Object, null); MutateAdGroupsResponse response = client.MutateAdGroups(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateAdGroups() { Mock <AdGroupService.AdGroupServiceClient> mockGrpcClient = new Mock <AdGroupService.AdGroupServiceClient>(MockBehavior.Strict); MutateAdGroupsRequest expectedRequest = new MutateAdGroupsRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateAdGroupsResponse expectedResponse = new MutateAdGroupsResponse(); mockGrpcClient.Setup(x => x.MutateAdGroups(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); AdGroupServiceClient client = new AdGroupServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <AdGroupOperation> operations = new List <AdGroupOperation>(); bool partialFailure = true; bool validateOnly = false; MutateAdGroupsResponse response = client.MutateAdGroups(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }