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();
        }
        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();
        }
Esempio n. 3
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();
        }