Ejemplo n.º 1
0
 /// <summary>Snippet for GetXpnHost</summary>
 public void GetXpnHostRequestObject()
 {
     // Snippet: GetXpnHost(GetXpnHostProjectRequest, CallSettings)
     // Create client
     ProjectsClient projectsClient = ProjectsClient.Create();
     // Initialize request argument(s)
     GetXpnHostProjectRequest request = new GetXpnHostProjectRequest {
         Project = "",
     };
     // Make the request
     Project response = projectsClient.GetXpnHost(request);
     // End snippet
 }
Ejemplo n.º 2
0
        /// <summary>Snippet for GetXpnHostAsync</summary>
        public async Task GetXpnHostRequestObjectAsync()
        {
            // Snippet: GetXpnHostAsync(GetXpnHostProjectRequest, CallSettings)
            // Additional: GetXpnHostAsync(GetXpnHostProjectRequest, CancellationToken)
            // Create client
            ProjectsClient projectsClient = await ProjectsClient.CreateAsync();

            // Initialize request argument(s)
            GetXpnHostProjectRequest request = new GetXpnHostProjectRequest {
                Project = "",
            };
            // Make the request
            Project response = await projectsClient.GetXpnHostAsync(request);

            // End snippet
        }
Ejemplo n.º 3
0
        public async stt::Task GetXpnHostAsync()
        {
            moq::Mock <Projects.ProjectsClient> mockGrpcClient = new moq::Mock <Projects.ProjectsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetXpnHostProjectRequest request = new GetXpnHostProjectRequest
            {
                Project = "projectaa6ff846",
            };
            Project expectedResponse = new Project
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp      = "creation_timestamp235e59a1",
                Quotas                 = { new Quota(), },
                CommonInstanceMetadata = new Metadata(),
                XpnProjectStatus       = "xpn_project_status547f92f1",
                DefaultServiceAccount  = "default_service_accountdf12b0f2",
                UsageExportLocation    = new UsageExportLocation(),
                Description            = "description2cf9da67",
                SelfLink               = "self_link7e87f12d",
                EnabledFeatures        =
                {
                    "enabled_featuresf1f398e0",
                },
                DefaultNetworkTier = "default_network_tier69d9d1a9",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 4
0
        public void GetXpnHost()
        {
            moq::Mock <Projects.ProjectsClient> mockGrpcClient = new moq::Mock <Projects.ProjectsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetXpnHostProjectRequest request = new GetXpnHostProjectRequest
            {
                Project = "projectaa6ff846",
            };
            Project expectedResponse = new Project
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp      = "creation_timestamp235e59a1",
                Quotas                 = { new Quota(), },
                CommonInstanceMetadata = new Metadata(),
                XpnProjectStatus       = Project.Types.XpnProjectStatus.Host,
                DefaultServiceAccount  = "default_service_accountdf12b0f2",
                UsageExportLocation    = new UsageExportLocation(),
                Description            = "description2cf9da67",
                SelfLink               = "self_link7e87f12d",
                EnabledFeatures        =
                {
                    "enabled_featuresf1f398e0",
                },
                DefaultNetworkTier = Project.Types.DefaultNetworkTier.Premium,
            };

            mockGrpcClient.Setup(x => x.GetXpnHost(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ProjectsClient client   = new ProjectsClientImpl(mockGrpcClient.Object, null);
            Project        response = client.GetXpnHost(request.Project);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }