public async stt::Task GetAsync() { moq::Mock <RegionNotificationEndpoints.RegionNotificationEndpointsClient> mockGrpcClient = new moq::Mock <RegionNotificationEndpoints.RegionNotificationEndpointsClient>(moq::MockBehavior.Strict); GetRegionNotificationEndpointRequest request = new GetRegionNotificationEndpointRequest { Region = "regionedb20d96", Project = "projectaa6ff846", NotificationEndpoint = "notification_endpointbe78db22", }; NotificationEndpoint expectedResponse = new NotificationEndpoint { Id = "id74b70bb8", Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", Region = "regionedb20d96", Description = "description2cf9da67", GrpcSettings = new NotificationEndpointGrpcSettings(), SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <NotificationEndpoint>(stt::Task.FromResult(expectedResponse), null, null, null, null)); RegionNotificationEndpointsClient client = new RegionNotificationEndpointsClientImpl(mockGrpcClient.Object, null); NotificationEndpoint responseCallSettings = await client.GetAsync(request.Project, request.Region, request.NotificationEndpoint, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); NotificationEndpoint responseCancellationToken = await client.GetAsync(request.Project, request.Region, request.NotificationEndpoint, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetRequestObject() { moq::Mock <RegionNotificationEndpoints.RegionNotificationEndpointsClient> mockGrpcClient = new moq::Mock <RegionNotificationEndpoints.RegionNotificationEndpointsClient>(moq::MockBehavior.Strict); GetRegionNotificationEndpointRequest request = new GetRegionNotificationEndpointRequest { Region = "regionedb20d96", Project = "projectaa6ff846", NotificationEndpoint = "notification_endpointbe78db22", }; NotificationEndpoint expectedResponse = new NotificationEndpoint { Id = "id74b70bb8", Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", Region = "regionedb20d96", Description = "description2cf9da67", GrpcSettings = new NotificationEndpointGrpcSettings(), SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RegionNotificationEndpointsClient client = new RegionNotificationEndpointsClientImpl(mockGrpcClient.Object, null); NotificationEndpoint response = client.Get(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetRegionNotificationEndpointRequest, CallSettings) // Create client RegionNotificationEndpointsClient regionNotificationEndpointsClient = RegionNotificationEndpointsClient.Create(); // Initialize request argument(s) GetRegionNotificationEndpointRequest request = new GetRegionNotificationEndpointRequest { Region = "", Project = "", NotificationEndpoint = "", }; // Make the request NotificationEndpoint response = regionNotificationEndpointsClient.Get(request); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetRegionNotificationEndpointRequest, CallSettings) // Additional: GetAsync(GetRegionNotificationEndpointRequest, CancellationToken) // Create client RegionNotificationEndpointsClient regionNotificationEndpointsClient = await RegionNotificationEndpointsClient.CreateAsync(); // Initialize request argument(s) GetRegionNotificationEndpointRequest request = new GetRegionNotificationEndpointRequest { Region = "", Project = "", NotificationEndpoint = "", }; // Make the request NotificationEndpoint response = await regionNotificationEndpointsClient.GetAsync(request); // End snippet }
/// <summary> /// Returns the specified NotificationEndpoint resource in the given region. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task <NotificationEndpoint> GetAsync(GetRegionNotificationEndpointRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetRegionNotificationEndpointRequest(ref request, ref callSettings); return(_callGet.Async(request, callSettings)); }
partial void Modify_GetRegionNotificationEndpointRequest(ref GetRegionNotificationEndpointRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Returns the specified NotificationEndpoint resource in the given region. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <NotificationEndpoint> GetAsync(GetRegionNotificationEndpointRequest request, st::CancellationToken cancellationToken) => GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Returns the specified NotificationEndpoint resource in the given region. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <NotificationEndpoint> GetAsync(GetRegionNotificationEndpointRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();