public async stt::Task GetTenantResourceNamesAsync()
        {
            moq::Mock <TenantService.TenantServiceClient> mockGrpcClient = new moq::Mock <TenantService.TenantServiceClient>(moq::MockBehavior.Strict);
            GetTenantRequest request = new GetTenantRequest
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
            };
            Tenant expectedResponse = new Tenant
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
                ExternalId = "external_id9442680e",
                UsageType  = Tenant.Types.DataUsageType.Unspecified,
                KeywordSearchableProfileCustomAttributes =
                {
                    "keyword_searchable_profile_custom_attributes9dbf9d03",
                },
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Tenant responseCancellationToken = await client.GetTenantAsync(request.TenantName, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemple #2
0
        public GetTenantResponse Get([FromBody] GetTenantRequest Request)
        {
            RequestInitialization(Request);
            GetTenantResponse response = _tenantService.Get(Request);

            return(response);
        }
        public void GetTenantResourceNames()
        {
            moq::Mock <TenantService.TenantServiceClient> mockGrpcClient = new moq::Mock <TenantService.TenantServiceClient>(moq::MockBehavior.Strict);
            GetTenantRequest request = new GetTenantRequest
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
            };
            Tenant expectedResponse = new Tenant
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
                ExternalId = "external_id9442680e",
                UsageType  = Tenant.Types.DataUsageType.Unspecified,
                KeywordSearchableProfileCustomAttributes =
                {
                    "keyword_searchable_profile_custom_attributes9dbf9d03",
                },
            };

            mockGrpcClient.Setup(x => x.GetTenant(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            TenantServiceClient client = new TenantServiceClientImpl(mockGrpcClient.Object, null);
            Tenant response            = client.GetTenant(request.TenantName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #4
0
        public GetTenantResponse Get(GetTenantRequest Request)
        {
            GetTenantResponse response = new GetTenantResponse();

            Tenant tenant = new Tenant();

            if (Request.Id.HasValue)
            {
                tenant = _uof.TenantRepository.GetById(Request.Id);
            }
            else if (Request.TenantId.HasValue)
            {
                tenant = _uof.TenantRepository.Find(r => r.TenantId == Request.TenantId.Value);
            }

            if (tenant == null)
            {
                response.IsSucceed  = false;
                response.ResultCode = (int)HttpStatusCode.NotFound;
                response.Message    = "Tenant bulunamadı.";

                return(response);
            }

            response.Tenant = _mapper.Map <Tenant, TenantViewModel>(tenant);

            return(response);
        }
 /// <summary>Snippet for GetTenant</summary>
 public void GetTenantRequestObject()
 {
     // Snippet: GetTenant(GetTenantRequest, CallSettings)
     // Create client
     TenantServiceClient tenantServiceClient = TenantServiceClient.Create();
     // Initialize request argument(s)
     GetTenantRequest request = new GetTenantRequest
     {
         TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
     };
     // Make the request
     Tenant response = tenantServiceClient.GetTenant(request);
     // End snippet
 }
Exemple #6
0
        // [START job_search_get_tenant_beta]
        public static object GetTenant(string projectId, string tenantId)
        {
            TenantServiceClient tenantServiceClient = TenantServiceClient.Create();
            TenantName          name    = new TenantName(projectId, tenantId);
            GetTenantRequest    request = new GetTenantRequest
            {
                TenantName = name
            };
            Tenant response = tenantServiceClient.GetTenant(request);

            Console.WriteLine($"Name: {response.Name}");
            Console.WriteLine($"External ID: {response.ExternalId}");
            return(0);
        }
        /// <summary>Snippet for GetTenantAsync</summary>
        public async Task GetTenantRequestObjectAsync()
        {
            // Snippet: GetTenantAsync(GetTenantRequest, CallSettings)
            // Additional: GetTenantAsync(GetTenantRequest, CancellationToken)
            // Create client
            TenantServiceClient tenantServiceClient = await TenantServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetTenantRequest request = new GetTenantRequest
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
            };
            // Make the request
            Tenant response = await tenantServiceClient.GetTenantAsync(request);

            // End snippet
        }
        public void GetTenantResourceNames()
        {
            moq::Mock <TenantService.TenantServiceClient> mockGrpcClient = new moq::Mock <TenantService.TenantServiceClient>(moq::MockBehavior.Strict);
            GetTenantRequest request = new GetTenantRequest
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
            };
            Tenant expectedResponse = new Tenant
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
                ExternalId = "external_id9442680e",
            };

            mockGrpcClient.Setup(x => x.GetTenant(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            TenantServiceClient client = new TenantServiceClientImpl(mockGrpcClient.Object, null);
            Tenant response            = client.GetTenant(request.TenantName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #9
0
        public async Task GetTenantAsync2()
        {
            Mock <TenantService.TenantServiceClient> mockGrpcClient = new Mock <TenantService.TenantServiceClient>(MockBehavior.Strict);
            GetTenantRequest request = new GetTenantRequest
            {
                TenantName = new TenantName("[PROJECT]", "[TENANT]"),
            };
            Tenant expectedResponse = new Tenant
            {
                TenantName = new TenantName("[PROJECT]", "[TENANT]"),
                ExternalId = "externalId-1153075697",
            };

            mockGrpcClient.Setup(x => x.GetTenantAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Tenant>(Task.FromResult(expectedResponse), null, null, null, null));
            TenantServiceClient client = new TenantServiceClientImpl(mockGrpcClient.Object, null);
            Tenant response            = await client.GetTenantAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #10
0
        public void GetTenant2()
        {
            Mock <TenantService.TenantServiceClient> mockGrpcClient = new Mock <TenantService.TenantServiceClient>(MockBehavior.Strict);
            GetTenantRequest request = new GetTenantRequest
            {
                TenantName = new TenantName("[PROJECT]", "[TENANT]"),
            };
            Tenant expectedResponse = new Tenant
            {
                TenantName = new TenantName("[PROJECT]", "[TENANT]"),
                ExternalId = "externalId-1153075697",
            };

            mockGrpcClient.Setup(x => x.GetTenant(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            TenantServiceClient client = new TenantServiceClientImpl(mockGrpcClient.Object, null);
            Tenant response            = client.GetTenant(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task GetTenantAsync()
        {
            moq::Mock <TenantService.TenantServiceClient> mockGrpcClient = new moq::Mock <TenantService.TenantServiceClient>(moq::MockBehavior.Strict);
            GetTenantRequest request = new GetTenantRequest
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
            };
            Tenant expectedResponse = new Tenant
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
                ExternalId = "external_id9442680e",
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Tenant responseCancellationToken = await client.GetTenantAsync(request.Name, st::CancellationToken.None);

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