コード例 #1
0
        public async stt::Task GetRequestObjectAsync()
        {
            moq::Mock <NodeTypes.NodeTypesClient> mockGrpcClient = new moq::Mock <NodeTypes.NodeTypesClient>(moq::MockBehavior.Strict);
            GetNodeTypeRequest request = new GetNodeTypeRequest
            {
                Zone     = "zone255f4ea8",
                Project  = "projectaa6ff846",
                NodeType = "node_type98c685da",
            };
            NodeType expectedResponse = new NodeType
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                Zone = "zone255f4ea8",
                CreationTimestamp = "creation_timestamp235e59a1",
                MemoryMb          = -1241574521,
                LocalSsdGb        = -81635889,
                GuestCpus         = 325324266,
                CpuPlatform       = "cpu_platformd5794042",
                Description       = "description2cf9da67",
                SelfLink          = "self_link7e87f12d",
                Deprecated        = new DeprecationStatus(),
            };

            mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <NodeType>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            NodeTypesClient client = new NodeTypesClientImpl(mockGrpcClient.Object, null);
            NodeType        responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            NodeType responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public void Get()
        {
            moq::Mock <NodeTypes.NodeTypesClient> mockGrpcClient = new moq::Mock <NodeTypes.NodeTypesClient>(moq::MockBehavior.Strict);
            GetNodeTypeRequest request = new GetNodeTypeRequest
            {
                Zone     = "zone255f4ea8",
                NodeType = "node_type98c685da",
                Project  = "projectaa6ff846",
            };
            NodeType expectedResponse = new NodeType
            {
                Id   = "id74b70bb8",
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                Zone = "zone255f4ea8",
                CreationTimestamp = "creation_timestamp235e59a1",
                LocalSsdGb        = -81635889,
                MemoryMb          = -1241574521,
                GuestCpus         = 325324266,
                CpuPlatform       = "cpu_platformd5794042",
                Description       = "description2cf9da67",
                SelfLink          = "self_link7e87f12d",
                Deprecated        = new DeprecationStatus(),
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            NodeTypesClient client   = new NodeTypesClientImpl(mockGrpcClient.Object, null);
            NodeType        response = client.Get(request.Project, request.Zone, request.NodeType);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #3
0
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetNodeTypeRequest, CallSettings)
     // Create client
     NodeTypesClient nodeTypesClient = NodeTypesClient.Create();
     // Initialize request argument(s)
     GetNodeTypeRequest request = new GetNodeTypeRequest
     {
         Zone     = "",
         Project  = "",
         NodeType = "",
     };
     // Make the request
     NodeType response = nodeTypesClient.Get(request);
     // End snippet
 }
コード例 #4
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetNodeTypeRequest, CallSettings)
            // Additional: GetAsync(GetNodeTypeRequest, CancellationToken)
            // Create client
            NodeTypesClient nodeTypesClient = await NodeTypesClient.CreateAsync();

            // Initialize request argument(s)
            GetNodeTypeRequest request = new GetNodeTypeRequest
            {
                Zone     = "",
                Project  = "",
                NodeType = "",
            };
            // Make the request
            NodeType response = await nodeTypesClient.GetAsync(request);

            // End snippet
        }
コード例 #5
0
 /// <summary>
 /// Returns the specified node type. Gets a list of available node 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 <NodeType> GetAsync(GetNodeTypeRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_GetNodeTypeRequest(ref request, ref callSettings);
     return(_callGet.Async(request, callSettings));
 }
コード例 #6
0
 /// <summary>
 /// Returns the specified node type. Gets a list of available node 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 NodeType Get(GetNodeTypeRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_GetNodeTypeRequest(ref request, ref callSettings);
     return(_callGet.Sync(request, callSettings));
 }
コード例 #7
0
 partial void Modify_GetNodeTypeRequest(ref GetNodeTypeRequest request, ref gaxgrpc::CallSettings settings);
コード例 #8
0
 /// <summary>
 /// Returns the specified node type. Gets a list of available node 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 <NodeType> GetAsync(GetNodeTypeRequest request, st::CancellationToken cancellationToken) =>
 GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
コード例 #9
0
 /// <summary>
 /// Returns the specified node type. Gets a list of available node 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 <NodeType> GetAsync(GetNodeTypeRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
コード例 #10
0
 /// <summary>
 /// Returns the specified node type. Gets a list of available node 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 NodeType Get(GetNodeTypeRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();