public async stt::Task GetFeedMappingRequestObjectAsync() { moq::Mock <FeedMappingService.FeedMappingServiceClient> mockGrpcClient = new moq::Mock <FeedMappingService.FeedMappingServiceClient>(moq::MockBehavior.Strict); GetFeedMappingRequest request = new GetFeedMappingRequest { ResourceNameAsFeedMappingName = gagvr::FeedMappingName.FromCustomerFeedMapping("[CUSTOMER]", "[FEED_MAPPING]"), }; gagvr::FeedMapping expectedResponse = new gagvr::FeedMapping { ResourceNameAsFeedMappingName = gagvr::FeedMappingName.FromCustomerFeedMapping("[CUSTOMER]", "[FEED_MAPPING]"), FeedAsFeedName = gagvr::FeedName.FromCustomerFeed("[CUSTOMER]", "[FEED]"), PlaceholderType = gagve::PlaceholderTypeEnum.Types.PlaceholderType.Message, CriterionType = gagve::FeedMappingCriterionTypeEnum.Types.FeedMappingCriterionType.Unknown, AttributeFieldMappings = { new gagvr::AttributeFieldMapping(), }, Status = gagve::FeedMappingStatusEnum.Types.FeedMappingStatus.Enabled, }; mockGrpcClient.Setup(x => x.GetFeedMappingAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::FeedMapping>(stt::Task.FromResult(expectedResponse), null, null, null, null)); FeedMappingServiceClient client = new FeedMappingServiceClientImpl(mockGrpcClient.Object, null); gagvr::FeedMapping responseCallSettings = await client.GetFeedMappingAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::FeedMapping responseCancellationToken = await client.GetFeedMappingAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetFeedMapping() { moq::Mock <FeedMappingService.FeedMappingServiceClient> mockGrpcClient = new moq::Mock <FeedMappingService.FeedMappingServiceClient>(moq::MockBehavior.Strict); GetFeedMappingRequest request = new GetFeedMappingRequest { ResourceNameAsFeedMappingName = gagvr::FeedMappingName.FromCustomerFeedMapping("[CUSTOMER]", "[FEED_MAPPING]"), }; gagvr::FeedMapping expectedResponse = new gagvr::FeedMapping { ResourceNameAsFeedMappingName = gagvr::FeedMappingName.FromCustomerFeedMapping("[CUSTOMER]", "[FEED_MAPPING]"), FeedAsFeedName = gagvr::FeedName.FromCustomerFeed("[CUSTOMER]", "[FEED]"), PlaceholderType = gagve::PlaceholderTypeEnum.Types.PlaceholderType.Message, CriterionType = gagve::FeedMappingCriterionTypeEnum.Types.FeedMappingCriterionType.Unknown, AttributeFieldMappings = { new gagvr::AttributeFieldMapping(), }, Status = gagve::FeedMappingStatusEnum.Types.FeedMappingStatus.Enabled, }; mockGrpcClient.Setup(x => x.GetFeedMapping(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); FeedMappingServiceClient client = new FeedMappingServiceClientImpl(mockGrpcClient.Object, null); gagvr::FeedMapping response = client.GetFeedMapping(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetFeedMapping</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetFeedMappingRequestObject() { // Create client FeedMappingServiceClient feedMappingServiceClient = FeedMappingServiceClient.Create(); // Initialize request argument(s) GetFeedMappingRequest request = new GetFeedMappingRequest { ResourceNameAsFeedMappingName = FeedMappingName.FromCustomerFeedMapping("[CUSTOMER]", "[FEED_MAPPING]"), }; // Make the request FeedMapping response = feedMappingServiceClient.GetFeedMapping(request); }
/// <summary>Snippet for GetFeedMappingAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetFeedMappingRequestObjectAsync() { // Create client FeedMappingServiceClient feedMappingServiceClient = await FeedMappingServiceClient.CreateAsync(); // Initialize request argument(s) GetFeedMappingRequest request = new GetFeedMappingRequest { ResourceNameAsFeedMappingName = FeedMappingName.FromCustomerFeedFeedMapping("[CUSTOMER_ID]", "[FEED_ID]", "[FEED_MAPPING_ID]"), }; // Make the request FeedMapping response = await feedMappingServiceClient.GetFeedMappingAsync(request); }
/// <summary>Snippet for GetFeedMappingAsync</summary> public async Task GetFeedMappingRequestObjectAsync() { // Snippet: GetFeedMappingAsync(GetFeedMappingRequest, CallSettings) // Additional: GetFeedMappingAsync(GetFeedMappingRequest, CancellationToken) // Create client FeedMappingServiceClient feedMappingServiceClient = await FeedMappingServiceClient.CreateAsync(); // Initialize request argument(s) GetFeedMappingRequest request = new GetFeedMappingRequest { ResourceNameAsFeedMappingName = FeedMappingName.FromCustomerFeedFeedMapping("[CUSTOMER_ID]", "[FEED_ID]", "[FEED_MAPPING_ID]"), }; // Make the request FeedMapping response = await feedMappingServiceClient.GetFeedMappingAsync(request); // End snippet }
public void GetFeedMapping2() { Mock <FeedMappingService.FeedMappingServiceClient> mockGrpcClient = new Mock <FeedMappingService.FeedMappingServiceClient>(MockBehavior.Strict); GetFeedMappingRequest request = new GetFeedMappingRequest { ResourceName = new FeedMappingName("[CUSTOMER]", "[FEED_MAPPING]").ToString(), }; FeedMapping expectedResponse = new FeedMapping { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetFeedMapping(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); FeedMappingServiceClient client = new FeedMappingServiceClientImpl(mockGrpcClient.Object, null); FeedMapping response = client.GetFeedMapping(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetFeedMappingAsync2() { Mock <FeedMappingService.FeedMappingServiceClient> mockGrpcClient = new Mock <FeedMappingService.FeedMappingServiceClient>(MockBehavior.Strict); GetFeedMappingRequest request = new GetFeedMappingRequest { ResourceName = new FeedMappingName("[CUSTOMER]", "[FEED_MAPPING]").ToString(), }; FeedMapping expectedResponse = new FeedMapping { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetFeedMappingAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <FeedMapping>(Task.FromResult(expectedResponse), null, null, null, null)); FeedMappingServiceClient client = new FeedMappingServiceClientImpl(mockGrpcClient.Object, null); FeedMapping response = await client.GetFeedMappingAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }