Beispiel #1
0
        public async Task GetJobAsync()
        {
            Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict);
            GetJobRequest expectedRequest = new GetJobRequest
            {
                JobNameOneof = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")),
            };
            Job expectedResponse = new Job
            {
                JobNameOneof = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")),
                CompanyAsCompanyNameOneof = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")),
                RequisitionId             = "requisitionId980224926",
                Title              = "title110371416",
                Description        = "description-1724546052",
                Department         = "department848184146",
                Incentives         = "incentives-1262874520",
                LanguageCode       = "languageCode-412800396",
                PromotionValue     = 353413845,
                Qualifications     = "qualifications1903501412",
                Responsibilities   = "responsibilities-926952660",
                CompanyDisplayName = "companyDisplayName1982424170",
            };

            mockGrpcClient.Setup(x => x.GetJobAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Job>(Task.FromResult(expectedResponse), null, null, null, null));
            JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null);
            JobNameOneof     name   = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]"));
            Job response            = await client.GetJobAsync(name);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
        public void CreateJob2()
        {
            Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict);
            CreateJobRequest request = new CreateJobRequest
            {
                ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
                Job = new Job(),
            };
            Job expectedResponse = new Job
            {
                JobNameOneof = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")),
                CompanyAsCompanyNameOneof = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")),
                RequisitionId             = "requisitionId980224926",
                Title              = "title110371416",
                Description        = "description-1724546052",
                Department         = "department848184146",
                Incentives         = "incentives-1262874520",
                LanguageCode       = "languageCode-412800396",
                PromotionValue     = 353413845,
                Qualifications     = "qualifications1903501412",
                Responsibilities   = "responsibilities-926952660",
                CompanyDisplayName = "companyDisplayName1982424170",
            };

            mockGrpcClient.Setup(x => x.CreateJob(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null);
            Job response            = client.CreateJob(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #3
0
        public async Task CreateCompanyAsync()
        {
            Mock <CompanyService.CompanyServiceClient> mockGrpcClient = new Mock <CompanyService.CompanyServiceClient>(MockBehavior.Strict);
            CreateCompanyRequest expectedRequest = new CreateCompanyRequest
            {
                ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
                Company = new Company(),
            };
            Company expectedResponse = new Company
            {
                CompanyNameOneof    = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")),
                DisplayName         = "displayName1615086568",
                ExternalId          = "externalId-1153075697",
                HeadquartersAddress = "headquartersAddress-1879520036",
                HiringAgency        = false,
                EeoText             = "eeoText-1652097123",
                WebsiteUri          = "websiteUri-2118185016",
                CareerSiteUri       = "careerSiteUri1223331861",
                ImageUri            = "imageUri-877823864",
                Suspended           = false,
            };

            mockGrpcClient.Setup(x => x.CreateCompanyAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Company>(Task.FromResult(expectedResponse), null, null, null, null));
            CompanyServiceClient     client = new CompanyServiceClientImpl(mockGrpcClient.Object, null);
            TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]"));
            Company company  = new Company();
            Company response = await client.CreateCompanyAsync(parent, company);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #4
0
        public void UpdateCompany2()
        {
            Mock <CompanyService.CompanyServiceClient> mockGrpcClient = new Mock <CompanyService.CompanyServiceClient>(MockBehavior.Strict);
            UpdateCompanyRequest request = new UpdateCompanyRequest
            {
                Company = new Company(),
            };
            Company expectedResponse = new Company
            {
                CompanyNameOneof    = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")),
                DisplayName         = "displayName1615086568",
                ExternalId          = "externalId-1153075697",
                HeadquartersAddress = "headquartersAddress-1879520036",
                HiringAgency        = false,
                EeoText             = "eeoText-1652097123",
                WebsiteUri          = "websiteUri-2118185016",
                CareerSiteUri       = "careerSiteUri1223331861",
                ImageUri            = "imageUri-877823864",
                Suspended           = false,
            };

            mockGrpcClient.Setup(x => x.UpdateCompany(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CompanyServiceClient client = new CompanyServiceClientImpl(mockGrpcClient.Object, null);
            Company response            = client.UpdateCompany(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for GetCompany</summary>
 public void GetCompany()
 {
     // Snippet: GetCompany(CompanyNameOneof,CallSettings)
     // Create client
     CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
     // Initialize request argument(s)
     CompanyNameOneof name = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]"));
     // Make the request
     Company response = companyServiceClient.GetCompany(name);
     // End snippet
 }
        /// <summary>Snippet for DeleteCompanyAsync</summary>
        public async Task DeleteCompanyAsync()
        {
            // Snippet: DeleteCompanyAsync(CompanyNameOneof,CallSettings)
            // Additional: DeleteCompanyAsync(CompanyNameOneof,CancellationToken)
            // Create client
            CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();

            // Initialize request argument(s)
            CompanyNameOneof name = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]"));
            // Make the request
            await companyServiceClient.DeleteCompanyAsync(name);

            // End snippet
        }
 /// <summary>Snippet for GetCompany</summary>
 public void GetCompany_RequestObject()
 {
     // Snippet: GetCompany(GetCompanyRequest,CallSettings)
     // Create client
     CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
     // Initialize request argument(s)
     GetCompanyRequest request = new GetCompanyRequest
     {
         CompanyNameOneof = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")),
     };
     // Make the request
     Company response = companyServiceClient.GetCompany(request);
     // End snippet
 }
Beispiel #8
0
        /// <summary>Snippet for DeleteCompany</summary>
        public void DeleteCompany_RequestObject()
        {
            // Snippet: DeleteCompany(DeleteCompanyRequest,CallSettings)
            // Create client
            CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
            // Initialize request argument(s)
            DeleteCompanyRequest request = new DeleteCompanyRequest
            {
                CompanyNameOneof = CompanyNameOneof.From(new CompanyOldName("[PROJECT]", "[COMPANY]")),
            };

            // Make the request
            companyServiceClient.DeleteCompany(request);
            // End snippet
        }
Beispiel #9
0
        // [START job_search_get_company_beta]
        public static object GetCompany(string projectId, string tenantId, string companyId)
        {
            CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
            CompanyName          company = new CompanyName(projectId, tenantId, companyId);

            GetCompanyRequest request = new GetCompanyRequest
            {
                CompanyNameOneof = CompanyNameOneof.From(company)
            };
            var response = companyServiceClient.GetCompany(request);

            Console.WriteLine($"Company name: {response.Name}");
            Console.WriteLine($"Display name: {response.DisplayName}");
            return(0);
        }
Beispiel #10
0
        public async Task DeleteCompanyAsync2()
        {
            Mock <CompanyService.CompanyServiceClient> mockGrpcClient = new Mock <CompanyService.CompanyServiceClient>(MockBehavior.Strict);
            DeleteCompanyRequest request = new DeleteCompanyRequest
            {
                CompanyNameOneof = CompanyNameOneof.From(new CompanyOldName("[PROJECT]", "[COMPANY]")),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteCompanyAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            CompanyServiceClient client = new CompanyServiceClientImpl(mockGrpcClient.Object, null);
            await client.DeleteCompanyAsync(request);

            mockGrpcClient.VerifyAll();
        }
Beispiel #11
0
        public void DeleteCompany2()
        {
            Mock <CompanyService.CompanyServiceClient> mockGrpcClient = new Mock <CompanyService.CompanyServiceClient>(MockBehavior.Strict);
            DeleteCompanyRequest request = new DeleteCompanyRequest
            {
                CompanyNameOneof = CompanyNameOneof.From(new CompanyOldName("[PROJECT]", "[COMPANY]")),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteCompany(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CompanyServiceClient client = new CompanyServiceClientImpl(mockGrpcClient.Object, null);

            client.DeleteCompany(request);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for GetCompanyAsync</summary>
        public async Task GetCompanyAsync_RequestObject()
        {
            // Snippet: GetCompanyAsync(GetCompanyRequest,CallSettings)
            // Additional: GetCompanyAsync(GetCompanyRequest,CancellationToken)
            // Create client
            CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetCompanyRequest request = new GetCompanyRequest
            {
                CompanyNameOneof = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")),
            };
            // Make the request
            Company response = await companyServiceClient.GetCompanyAsync(request);

            // End snippet
        }
Beispiel #13
0
 public TalentFixture()
 {
     CreatedCompanyName = CreateSampleCompany();
 }