/// <summary>Snippet for GetHotelPerformanceView</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetHotelPerformanceViewRequestObject() { // Create client HotelPerformanceViewServiceClient hotelPerformanceViewServiceClient = HotelPerformanceViewServiceClient.Create(); // Initialize request argument(s) GetHotelPerformanceViewRequest request = new GetHotelPerformanceViewRequest { ResourceNameAsHotelPerformanceViewName = HotelPerformanceViewName.FromCustomer("[CUSTOMER_ID]"), }; // Make the request HotelPerformanceView response = hotelPerformanceViewServiceClient.GetHotelPerformanceView(request); }
/// <summary>Snippet for GetHotelPerformanceViewAsync</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 GetHotelPerformanceViewRequestObjectAsync() { // Create client HotelPerformanceViewServiceClient hotelPerformanceViewServiceClient = await HotelPerformanceViewServiceClient.CreateAsync(); // Initialize request argument(s) GetHotelPerformanceViewRequest request = new GetHotelPerformanceViewRequest { ResourceNameAsHotelPerformanceViewName = HotelPerformanceViewName.FromCustomer("[CUSTOMER]"), }; // Make the request HotelPerformanceView response = await hotelPerformanceViewServiceClient.GetHotelPerformanceViewAsync(request); }
/// <summary>Snippet for GetHotelPerformanceViewAsync</summary> public async Task GetHotelPerformanceViewRequestObjectAsync() { // Snippet: GetHotelPerformanceViewAsync(GetHotelPerformanceViewRequest, CallSettings) // Additional: GetHotelPerformanceViewAsync(GetHotelPerformanceViewRequest, CancellationToken) // Create client HotelPerformanceViewServiceClient hotelPerformanceViewServiceClient = await HotelPerformanceViewServiceClient.CreateAsync(); // Initialize request argument(s) GetHotelPerformanceViewRequest request = new GetHotelPerformanceViewRequest { ResourceNameAsHotelPerformanceViewName = HotelPerformanceViewName.FromCustomer("[CUSTOMER_ID]"), }; // Make the request HotelPerformanceView response = await hotelPerformanceViewServiceClient.GetHotelPerformanceViewAsync(request); // End snippet }
public void GetHotelPerformanceView() { moq::Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient> mockGrpcClient = new moq::Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient>(moq::MockBehavior.Strict); GetHotelPerformanceViewRequest request = new GetHotelPerformanceViewRequest { ResourceNameAsHotelPerformanceViewName = gagvr::HotelPerformanceViewName.FromCustomer("[CUSTOMER]"), }; gagvr::HotelPerformanceView expectedResponse = new gagvr::HotelPerformanceView { ResourceNameAsHotelPerformanceViewName = gagvr::HotelPerformanceViewName.FromCustomer("[CUSTOMER]"), }; mockGrpcClient.Setup(x => x.GetHotelPerformanceView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); HotelPerformanceViewServiceClient client = new HotelPerformanceViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::HotelPerformanceView response = client.GetHotelPerformanceView(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetHotelPerformanceView2() { Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient> mockGrpcClient = new Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient>(MockBehavior.Strict); GetHotelPerformanceViewRequest request = new GetHotelPerformanceViewRequest { ResourceName = new HotelPerformanceViewName("[CUSTOMER]").ToString(), }; HotelPerformanceView expectedResponse = new HotelPerformanceView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetHotelPerformanceView(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); HotelPerformanceViewServiceClient client = new HotelPerformanceViewServiceClientImpl(mockGrpcClient.Object, null); HotelPerformanceView response = client.GetHotelPerformanceView(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetHotelPerformanceViewAsync2() { Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient> mockGrpcClient = new Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient>(MockBehavior.Strict); GetHotelPerformanceViewRequest request = new GetHotelPerformanceViewRequest { ResourceName = new HotelPerformanceViewName("[CUSTOMER]").ToString(), }; HotelPerformanceView expectedResponse = new HotelPerformanceView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetHotelPerformanceViewAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <HotelPerformanceView>(Task.FromResult(expectedResponse), null, null, null, null)); HotelPerformanceViewServiceClient client = new HotelPerformanceViewServiceClientImpl(mockGrpcClient.Object, null); HotelPerformanceView response = await client.GetHotelPerformanceViewAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetHotelPerformanceViewAsync() { moq::Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient> mockGrpcClient = new moq::Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient>(moq::MockBehavior.Strict); GetHotelPerformanceViewRequest request = new GetHotelPerformanceViewRequest { ResourceNameAsHotelPerformanceViewName = gagvr::HotelPerformanceViewName.FromCustomer("[CUSTOMER]"), }; gagvr::HotelPerformanceView expectedResponse = new gagvr::HotelPerformanceView { ResourceNameAsHotelPerformanceViewName = gagvr::HotelPerformanceViewName.FromCustomer("[CUSTOMER]"), }; mockGrpcClient.Setup(x => x.GetHotelPerformanceViewAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::HotelPerformanceView>(stt::Task.FromResult(expectedResponse), null, null, null, null)); HotelPerformanceViewServiceClient client = new HotelPerformanceViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::HotelPerformanceView responseCallSettings = await client.GetHotelPerformanceViewAsync(request.ResourceName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::HotelPerformanceView responseCancellationToken = await client.GetHotelPerformanceViewAsync(request.ResourceName, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }