public void GetFeedItemTarget() { moq::Mock <FeedItemTargetService.FeedItemTargetServiceClient> mockGrpcClient = new moq::Mock <FeedItemTargetService.FeedItemTargetServiceClient>(moq::MockBehavior.Strict); GetFeedItemTargetRequest request = new GetFeedItemTargetRequest { ResourceNameAsFeedItemTargetName = gagvr::FeedItemTargetName.FromCustomerFeedItemTarget("[CUSTOMER]", "[FEED_ITEM_TARGET]"), }; gagvr::FeedItemTarget expectedResponse = new gagvr::FeedItemTarget { ResourceNameAsFeedItemTargetName = gagvr::FeedItemTargetName.FromCustomerFeedItemTarget("[CUSTOMER]", "[FEED_ITEM_TARGET]"), FeedItemAsFeedItemName = gagvr::FeedItemName.FromCustomerFeedItem("[CUSTOMER]", "[FEED_ITEM]"), FeedItemTargetType = gagve::FeedItemTargetTypeEnum.Types.FeedItemTargetType.Criterion, CampaignAsCampaignName = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"), AdGroupAsAdGroupName = gagvr::AdGroupName.FromCustomerAdGroup("[CUSTOMER]", "[AD_GROUP]"), FeedItemTargetId = -5234855566520350663L, Keyword = new gagvc::KeywordInfo(), GeoTargetConstantAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"), Device = gagve::FeedItemTargetDeviceEnum.Types.FeedItemTargetDevice.Mobile, AdSchedule = new gagvc::AdScheduleInfo(), Status = gagve::FeedItemTargetStatusEnum.Types.FeedItemTargetStatus.Enabled, }; mockGrpcClient.Setup(x => x.GetFeedItemTarget(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); FeedItemTargetServiceClient client = new FeedItemTargetServiceClientImpl(mockGrpcClient.Object, null); gagvr::FeedItemTarget response = client.GetFeedItemTarget(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetFeedItemTarget2() { Mock <FeedItemTargetService.FeedItemTargetServiceClient> mockGrpcClient = new Mock <FeedItemTargetService.FeedItemTargetServiceClient>(MockBehavior.Strict); GetFeedItemTargetRequest request = new GetFeedItemTargetRequest { ResourceName = new FeedItemTargetName("[CUSTOMER]", "[FEED_ITEM_TARGET]").ToString(), }; FeedItemTarget expectedResponse = new FeedItemTarget { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetFeedItemTarget(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); FeedItemTargetServiceClient client = new FeedItemTargetServiceClientImpl(mockGrpcClient.Object, null); FeedItemTarget response = client.GetFeedItemTarget(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }