public void Get() { moq::Mock <DiskTypes.DiskTypesClient> mockGrpcClient = new moq::Mock <DiskTypes.DiskTypesClient>(moq::MockBehavior.Strict); GetDiskTypeRequest request = new GetDiskTypeRequest { Zone = "zone255f4ea8", DiskType = "disk_type355e37bc", Project = "projectaa6ff846", }; DiskType expectedResponse = new DiskType { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", Region = "regionedb20d96", DefaultDiskSizeGb = -2608545772571403259L, Description = "description2cf9da67", SelfLink = "self_link7e87f12d", ValidDiskSize = "valid_disk_size58dd558f", Deprecated = new DeprecationStatus(), }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); DiskTypesClient client = new DiskTypesClientImpl(mockGrpcClient.Object, null); DiskType response = client.Get(request.Project, request.Zone, request.DiskType); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetRequestObjectAsync() { moq::Mock <DiskTypes.DiskTypesClient> mockGrpcClient = new moq::Mock <DiskTypes.DiskTypesClient>(moq::MockBehavior.Strict); GetDiskTypeRequest request = new GetDiskTypeRequest { Zone = "zone255f4ea8", DiskType = "disk_type355e37bc", Project = "projectaa6ff846", }; DiskType expectedResponse = new DiskType { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", Region = "regionedb20d96", DefaultDiskSizeGb = -2608545772571403259L, Description = "description2cf9da67", SelfLink = "self_link7e87f12d", ValidDiskSize = "valid_disk_size58dd558f", Deprecated = new DeprecationStatus(), }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <DiskType>(stt::Task.FromResult(expectedResponse), null, null, null, null)); DiskTypesClient client = new DiskTypesClientImpl(mockGrpcClient.Object, null); DiskType responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); DiskType responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetDiskTypeRequest, CallSettings) // Create client DiskTypesClient diskTypesClient = DiskTypesClient.Create(); // Initialize request argument(s) GetDiskTypeRequest request = new GetDiskTypeRequest { Zone = "", DiskType = "", Project = "", }; // Make the request DiskType response = diskTypesClient.Get(request); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetDiskTypeRequest, CallSettings) // Additional: GetAsync(GetDiskTypeRequest, CancellationToken) // Create client DiskTypesClient diskTypesClient = await DiskTypesClient.CreateAsync(); // Initialize request argument(s) GetDiskTypeRequest request = new GetDiskTypeRequest { Zone = "", DiskType = "", Project = "", }; // Make the request DiskType response = await diskTypesClient.GetAsync(request); // End snippet }
/// <summary> /// Returns the specified disk type. Gets a list of available disk types by making a list() request. /// </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 <DiskType> GetAsync(GetDiskTypeRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetDiskTypeRequest(ref request, ref callSettings); return(_callGet.Async(request, callSettings)); }
/// <summary> /// Returns the specified disk type. Gets a list of available disk types by making a list() request. /// </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>The RPC response.</returns> public override DiskType Get(GetDiskTypeRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetDiskTypeRequest(ref request, ref callSettings); return(_callGet.Sync(request, callSettings)); }
partial void Modify_GetDiskTypeRequest(ref GetDiskTypeRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Returns the specified disk type. Gets a list of available disk types by making a list() request. /// </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 <DiskType> GetAsync(GetDiskTypeRequest request, st::CancellationToken cancellationToken) => GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Returns the specified disk type. Gets a list of available disk types by making a list() request. /// </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 <DiskType> GetAsync(GetDiskTypeRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Returns the specified disk type. Gets a list of available disk types by making a list() request. /// </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>The RPC response.</returns> public virtual DiskType Get(GetDiskTypeRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();