public void MutateCampaignFeeds() { moq::Mock <CampaignFeedService.CampaignFeedServiceClient> mockGrpcClient = new moq::Mock <CampaignFeedService.CampaignFeedServiceClient>(moq::MockBehavior.Strict); MutateCampaignFeedsRequest request = new MutateCampaignFeedsRequest { CustomerId = "customer_id3b3724cb", Operations = { new CampaignFeedOperation(), }, }; MutateCampaignFeedsResponse expectedResponse = new MutateCampaignFeedsResponse { Results = { new MutateCampaignFeedResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateCampaignFeeds(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CampaignFeedServiceClient client = new CampaignFeedServiceClientImpl(mockGrpcClient.Object, null); MutateCampaignFeedsResponse response = client.MutateCampaignFeeds(request.CustomerId, request.Operations); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCampaignFeedsRequestObject() { moq::Mock <CampaignFeedService.CampaignFeedServiceClient> mockGrpcClient = new moq::Mock <CampaignFeedService.CampaignFeedServiceClient>(moq::MockBehavior.Strict); MutateCampaignFeedsRequest request = new MutateCampaignFeedsRequest { CustomerId = "customer_id3b3724cb", Operations = { new CampaignFeedOperation(), }, PartialFailure = false, ValidateOnly = true, ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly, }; MutateCampaignFeedsResponse expectedResponse = new MutateCampaignFeedsResponse { Results = { new MutateCampaignFeedResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateCampaignFeeds(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CampaignFeedServiceClient client = new CampaignFeedServiceClientImpl(mockGrpcClient.Object, null); MutateCampaignFeedsResponse response = client.MutateCampaignFeeds(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCampaignFeeds3() { Mock <CampaignFeedService.CampaignFeedServiceClient> mockGrpcClient = new Mock <CampaignFeedService.CampaignFeedServiceClient>(MockBehavior.Strict); MutateCampaignFeedsRequest request = new MutateCampaignFeedsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateCampaignFeedsResponse expectedResponse = new MutateCampaignFeedsResponse(); mockGrpcClient.Setup(x => x.MutateCampaignFeeds(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); CampaignFeedServiceClient client = new CampaignFeedServiceClientImpl(mockGrpcClient.Object, null); MutateCampaignFeedsResponse response = client.MutateCampaignFeeds(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCampaignFeeds() { Mock <CampaignFeedService.CampaignFeedServiceClient> mockGrpcClient = new Mock <CampaignFeedService.CampaignFeedServiceClient>(MockBehavior.Strict); MutateCampaignFeedsRequest expectedRequest = new MutateCampaignFeedsRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateCampaignFeedsResponse expectedResponse = new MutateCampaignFeedsResponse(); mockGrpcClient.Setup(x => x.MutateCampaignFeeds(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); CampaignFeedServiceClient client = new CampaignFeedServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <CampaignFeedOperation> operations = new List <CampaignFeedOperation>(); bool partialFailure = true; bool validateOnly = false; MutateCampaignFeedsResponse response = client.MutateCampaignFeeds(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }