/// <summary>Snippet for GetShoppingPerformanceView</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetShoppingPerformanceViewRequestObject() { // Create client ShoppingPerformanceViewServiceClient shoppingPerformanceViewServiceClient = ShoppingPerformanceViewServiceClient.Create(); // Initialize request argument(s) GetShoppingPerformanceViewRequest request = new GetShoppingPerformanceViewRequest { ResourceNameAsShoppingPerformanceViewName = ShoppingPerformanceViewName.FromCustomer("[CUSTOMER_ID]"), }; // Make the request ShoppingPerformanceView response = shoppingPerformanceViewServiceClient.GetShoppingPerformanceView(request); }
/// <summary>Snippet for GetShoppingPerformanceViewAsync</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 GetShoppingPerformanceViewRequestObjectAsync() { // Create client ShoppingPerformanceViewServiceClient shoppingPerformanceViewServiceClient = await ShoppingPerformanceViewServiceClient.CreateAsync(); // Initialize request argument(s) GetShoppingPerformanceViewRequest request = new GetShoppingPerformanceViewRequest { ResourceNameAsShoppingPerformanceViewName = ShoppingPerformanceViewName.FromCustomer("[CUSTOMER]"), }; // Make the request ShoppingPerformanceView response = await shoppingPerformanceViewServiceClient.GetShoppingPerformanceViewAsync(request); }
/// <summary>Snippet for GetShoppingPerformanceViewAsync</summary> public async Task GetShoppingPerformanceViewRequestObjectAsync() { // Snippet: GetShoppingPerformanceViewAsync(GetShoppingPerformanceViewRequest, CallSettings) // Additional: GetShoppingPerformanceViewAsync(GetShoppingPerformanceViewRequest, CancellationToken) // Create client ShoppingPerformanceViewServiceClient shoppingPerformanceViewServiceClient = await ShoppingPerformanceViewServiceClient.CreateAsync(); // Initialize request argument(s) GetShoppingPerformanceViewRequest request = new GetShoppingPerformanceViewRequest { ResourceNameAsShoppingPerformanceViewName = ShoppingPerformanceViewName.FromCustomer("[CUSTOMER]"), }; // Make the request ShoppingPerformanceView response = await shoppingPerformanceViewServiceClient.GetShoppingPerformanceViewAsync(request); // End snippet }
public void GetShoppingPerformanceView() { moq::Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient> mockGrpcClient = new moq::Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient>(moq::MockBehavior.Strict); GetShoppingPerformanceViewRequest request = new GetShoppingPerformanceViewRequest { ResourceNameAsShoppingPerformanceViewName = gagvr::ShoppingPerformanceViewName.FromCustomer("[CUSTOMER]"), }; gagvr::ShoppingPerformanceView expectedResponse = new gagvr::ShoppingPerformanceView { ResourceNameAsShoppingPerformanceViewName = gagvr::ShoppingPerformanceViewName.FromCustomer("[CUSTOMER]"), }; mockGrpcClient.Setup(x => x.GetShoppingPerformanceView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ShoppingPerformanceViewServiceClient client = new ShoppingPerformanceViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::ShoppingPerformanceView response = client.GetShoppingPerformanceView(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetShoppingPerformanceView2() { Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient> mockGrpcClient = new Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient>(MockBehavior.Strict); GetShoppingPerformanceViewRequest request = new GetShoppingPerformanceViewRequest { ResourceName = new ShoppingPerformanceViewName("[CUSTOMER]").ToString(), }; ShoppingPerformanceView expectedResponse = new ShoppingPerformanceView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetShoppingPerformanceView(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); ShoppingPerformanceViewServiceClient client = new ShoppingPerformanceViewServiceClientImpl(mockGrpcClient.Object, null); ShoppingPerformanceView response = client.GetShoppingPerformanceView(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetShoppingPerformanceViewAsync2() { Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient> mockGrpcClient = new Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient>(MockBehavior.Strict); GetShoppingPerformanceViewRequest request = new GetShoppingPerformanceViewRequest { ResourceName = new ShoppingPerformanceViewName("[CUSTOMER]").ToString(), }; ShoppingPerformanceView expectedResponse = new ShoppingPerformanceView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetShoppingPerformanceViewAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ShoppingPerformanceView>(Task.FromResult(expectedResponse), null, null, null, null)); ShoppingPerformanceViewServiceClient client = new ShoppingPerformanceViewServiceClientImpl(mockGrpcClient.Object, null); ShoppingPerformanceView response = await client.GetShoppingPerformanceViewAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetShoppingPerformanceViewAsync() { moq::Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient> mockGrpcClient = new moq::Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient>(moq::MockBehavior.Strict); GetShoppingPerformanceViewRequest request = new GetShoppingPerformanceViewRequest { ResourceNameAsShoppingPerformanceViewName = gagvr::ShoppingPerformanceViewName.FromCustomer("[CUSTOMER]"), }; gagvr::ShoppingPerformanceView expectedResponse = new gagvr::ShoppingPerformanceView { ResourceNameAsShoppingPerformanceViewName = gagvr::ShoppingPerformanceViewName.FromCustomer("[CUSTOMER]"), }; mockGrpcClient.Setup(x => x.GetShoppingPerformanceViewAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::ShoppingPerformanceView>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ShoppingPerformanceViewServiceClient client = new ShoppingPerformanceViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::ShoppingPerformanceView responseCallSettings = await client.GetShoppingPerformanceViewAsync(request.ResourceName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::ShoppingPerformanceView responseCancellationToken = await client.GetShoppingPerformanceViewAsync(request.ResourceName, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }