/// <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 GetHotelPerformanceViewResourceNames() { // Create client HotelPerformanceViewServiceClient hotelPerformanceViewServiceClient = HotelPerformanceViewServiceClient.Create(); // Initialize request argument(s) HotelPerformanceViewName resourceName = HotelPerformanceViewName.FromCustomer("[CUSTOMER_ID]"); // Make the request HotelPerformanceView response = hotelPerformanceViewServiceClient.GetHotelPerformanceView(resourceName); }
/// <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 GetHotelPerformanceViewResourceNamesAsync() { // Create client HotelPerformanceViewServiceClient hotelPerformanceViewServiceClient = await HotelPerformanceViewServiceClient.CreateAsync(); // Initialize request argument(s) HotelPerformanceViewName resourceName = HotelPerformanceViewName.FromCustomer("[CUSTOMER_ID]"); // Make the request HotelPerformanceView response = await hotelPerformanceViewServiceClient.GetHotelPerformanceViewAsync(resourceName); }
/// <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]"), }; // Make the request HotelPerformanceView response = hotelPerformanceViewServiceClient.GetHotelPerformanceView(request); }
/// <summary>Snippet for GetHotelPerformanceViewAsync</summary> public async Task GetHotelPerformanceViewResourceNamesAsync() { // Snippet: GetHotelPerformanceViewAsync(HotelPerformanceViewName, CallSettings) // Additional: GetHotelPerformanceViewAsync(HotelPerformanceViewName, CancellationToken) // Create client HotelPerformanceViewServiceClient hotelPerformanceViewServiceClient = await HotelPerformanceViewServiceClient.CreateAsync(); // Initialize request argument(s) HotelPerformanceViewName resourceName = HotelPerformanceViewName.FromCustomer("[CUSTOMER_ID]"); // Make the request HotelPerformanceView response = await hotelPerformanceViewServiceClient.GetHotelPerformanceViewAsync(resourceName); // End snippet }
public async Task GetHotelPerformanceViewAsync() { Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient> mockGrpcClient = new Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient>(MockBehavior.Strict); GetHotelPerformanceViewRequest expectedRequest = new GetHotelPerformanceViewRequest { ResourceName = new HotelPerformanceViewName("[CUSTOMER]").ToString(), }; HotelPerformanceView expectedResponse = new HotelPerformanceView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetHotelPerformanceViewAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <HotelPerformanceView>(Task.FromResult(expectedResponse), null, null, null, null)); HotelPerformanceViewServiceClient client = new HotelPerformanceViewServiceClientImpl(mockGrpcClient.Object, null); string formattedResourceName = new HotelPerformanceViewName("[CUSTOMER]").ToString(); HotelPerformanceView response = await client.GetHotelPerformanceViewAsync(formattedResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetHotelPerformanceView() { Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient> mockGrpcClient = new Mock <HotelPerformanceViewService.HotelPerformanceViewServiceClient>(MockBehavior.Strict); GetHotelPerformanceViewRequest expectedRequest = new GetHotelPerformanceViewRequest { ResourceName = new HotelPerformanceViewName("[CUSTOMER]").ToString(), }; HotelPerformanceView expectedResponse = new HotelPerformanceView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetHotelPerformanceView(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); HotelPerformanceViewServiceClient client = new HotelPerformanceViewServiceClientImpl(mockGrpcClient.Object, null); string formattedResourceName = new HotelPerformanceViewName("[CUSTOMER]").ToString(); HotelPerformanceView response = client.GetHotelPerformanceView(formattedResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }