/// <summary>Snippet for GetFeedPlaceholderViewAsync</summary> public async Task GetFeedPlaceholderViewRequestObjectAsync() { // Snippet: GetFeedPlaceholderViewAsync(GetFeedPlaceholderViewRequest, CallSettings) // Additional: GetFeedPlaceholderViewAsync(GetFeedPlaceholderViewRequest, CancellationToken) // Create client FeedPlaceholderViewServiceClient feedPlaceholderViewServiceClient = await FeedPlaceholderViewServiceClient.CreateAsync(); // Initialize request argument(s) GetFeedPlaceholderViewRequest request = new GetFeedPlaceholderViewRequest { ResourceNameAsFeedPlaceholderViewName = FeedPlaceholderViewName.FromCustomerPlaceholderType("[CUSTOMER_ID]", "[PLACEHOLDER_TYPE]"), }; // Make the request FeedPlaceholderView response = await feedPlaceholderViewServiceClient.GetFeedPlaceholderViewAsync(request); // End snippet }
public async Task GetFeedPlaceholderViewAsync2() { Mock<FeedPlaceholderViewService.FeedPlaceholderViewServiceClient> mockGrpcClient = new Mock<FeedPlaceholderViewService.FeedPlaceholderViewServiceClient>(MockBehavior.Strict); GetFeedPlaceholderViewRequest request = new GetFeedPlaceholderViewRequest { ResourceName = new FeedPlaceholderViewName("[CUSTOMER]", "[FEED_PLACEHOLDER_VIEW]").ToString(), }; FeedPlaceholderView expectedResponse = new FeedPlaceholderView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetFeedPlaceholderViewAsync(request, It.IsAny<CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall<FeedPlaceholderView>(Task.FromResult(expectedResponse), null, null, null, null)); FeedPlaceholderViewServiceClient client = new FeedPlaceholderViewServiceClientImpl(mockGrpcClient.Object, null); FeedPlaceholderView response = await client.GetFeedPlaceholderViewAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetFeedPlaceholderView() { Mock<FeedPlaceholderViewService.FeedPlaceholderViewServiceClient> mockGrpcClient = new Mock<FeedPlaceholderViewService.FeedPlaceholderViewServiceClient>(MockBehavior.Strict); GetFeedPlaceholderViewRequest expectedRequest = new GetFeedPlaceholderViewRequest { ResourceName = new FeedPlaceholderViewName("[CUSTOMER]", "[FEED_PLACEHOLDER_VIEW]").ToString(), }; FeedPlaceholderView expectedResponse = new FeedPlaceholderView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetFeedPlaceholderView(expectedRequest, It.IsAny<CallOptions>())) .Returns(expectedResponse); FeedPlaceholderViewServiceClient client = new FeedPlaceholderViewServiceClientImpl(mockGrpcClient.Object, null); string formattedResourceName = new FeedPlaceholderViewName("[CUSTOMER]", "[FEED_PLACEHOLDER_VIEW]").ToString(); FeedPlaceholderView response = client.GetFeedPlaceholderView(formattedResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetFeedPlaceholderView() { moq::Mock <FeedPlaceholderViewService.FeedPlaceholderViewServiceClient> mockGrpcClient = new moq::Mock <FeedPlaceholderViewService.FeedPlaceholderViewServiceClient>(moq::MockBehavior.Strict); GetFeedPlaceholderViewRequest request = new GetFeedPlaceholderViewRequest { ResourceNameAsFeedPlaceholderViewName = gagvr::FeedPlaceholderViewName.FromCustomerFeedPlaceholderView("[CUSTOMER]", "[FEED_PLACEHOLDER_VIEW]"), }; gagvr::FeedPlaceholderView expectedResponse = new gagvr::FeedPlaceholderView { ResourceNameAsFeedPlaceholderViewName = gagvr::FeedPlaceholderViewName.FromCustomerFeedPlaceholderView("[CUSTOMER]", "[FEED_PLACEHOLDER_VIEW]"), PlaceholderType = gagve::PlaceholderTypeEnum.Types.PlaceholderType.Message, }; mockGrpcClient.Setup(x => x.GetFeedPlaceholderView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); FeedPlaceholderViewServiceClient client = new FeedPlaceholderViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::FeedPlaceholderView response = client.GetFeedPlaceholderView(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetFeedPlaceholderViewRequestObjectAsync() { moq::Mock <FeedPlaceholderViewService.FeedPlaceholderViewServiceClient> mockGrpcClient = new moq::Mock <FeedPlaceholderViewService.FeedPlaceholderViewServiceClient>(moq::MockBehavior.Strict); GetFeedPlaceholderViewRequest request = new GetFeedPlaceholderViewRequest { ResourceNameAsFeedPlaceholderViewName = gagvr::FeedPlaceholderViewName.FromCustomerFeedPlaceholderView("[CUSTOMER]", "[FEED_PLACEHOLDER_VIEW]"), }; gagvr::FeedPlaceholderView expectedResponse = new gagvr::FeedPlaceholderView { ResourceNameAsFeedPlaceholderViewName = gagvr::FeedPlaceholderViewName.FromCustomerFeedPlaceholderView("[CUSTOMER]", "[FEED_PLACEHOLDER_VIEW]"), PlaceholderType = gagve::PlaceholderTypeEnum.Types.PlaceholderType.Message, }; mockGrpcClient.Setup(x => x.GetFeedPlaceholderViewAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::FeedPlaceholderView>(stt::Task.FromResult(expectedResponse), null, null, null, null)); FeedPlaceholderViewServiceClient client = new FeedPlaceholderViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::FeedPlaceholderView responseCallSettings = await client.GetFeedPlaceholderViewAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::FeedPlaceholderView responseCancellationToken = await client.GetFeedPlaceholderViewAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }