public void MutateCampaignSharedSets() { moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(moq::MockBehavior.Strict); MutateCampaignSharedSetsRequest request = new MutateCampaignSharedSetsRequest { CustomerId = "customer_id3b3724cb", Operations = { new CampaignSharedSetOperation(), }, }; MutateCampaignSharedSetsResponse expectedResponse = new MutateCampaignSharedSetsResponse { Results = { new MutateCampaignSharedSetResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateCampaignSharedSets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CampaignSharedSetServiceClient client = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null); MutateCampaignSharedSetsResponse response = client.MutateCampaignSharedSets(request.CustomerId, request.Operations); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCampaignSharedSetsRequestObject() { moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(moq::MockBehavior.Strict); MutateCampaignSharedSetsRequest request = new MutateCampaignSharedSetsRequest { CustomerId = "customer_id3b3724cb", Operations = { new CampaignSharedSetOperation(), }, PartialFailure = false, ValidateOnly = true, ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly, }; MutateCampaignSharedSetsResponse expectedResponse = new MutateCampaignSharedSetsResponse { Results = { new MutateCampaignSharedSetResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateCampaignSharedSets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CampaignSharedSetServiceClient client = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null); MutateCampaignSharedSetsResponse response = client.MutateCampaignSharedSets(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCampaignSharedSets2() { Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(MockBehavior.Strict); MutateCampaignSharedSetsRequest request = new MutateCampaignSharedSetsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateCampaignSharedSetsResponse expectedResponse = new MutateCampaignSharedSetsResponse(); mockGrpcClient.Setup(x => x.MutateCampaignSharedSets(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); CampaignSharedSetServiceClient client = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null); MutateCampaignSharedSetsResponse response = client.MutateCampaignSharedSets(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCampaignSharedSets() { Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(MockBehavior.Strict); MutateCampaignSharedSetsRequest expectedRequest = new MutateCampaignSharedSetsRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateCampaignSharedSetsResponse expectedResponse = new MutateCampaignSharedSetsResponse(); mockGrpcClient.Setup(x => x.MutateCampaignSharedSets(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); CampaignSharedSetServiceClient client = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <CampaignSharedSetOperation> operations = new List <CampaignSharedSetOperation>(); bool partialFailure = true; bool validateOnly = false; MutateCampaignSharedSetsResponse response = client.MutateCampaignSharedSets(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }