public void CreateJob() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); CreateJobRequest expectedRequest = new CreateJobRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Job = new Job(), }; Job expectedResponse = new Job { JobNameOneof = JobNameOneof.From(new JobOldName("[PROJECT]", "[JOBS]")), Company = "company950484093", 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(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Job job = new Job(); Job response = client.CreateJob(parent, job); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void CreateJob() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); CreateJobRequest expectedRequest = new CreateJobRequest { Parent = new ProjectName("[PROJECT]").ToString(), Job = new Job(), }; Job expectedResponse = new Job { Name = "name3373707", CompanyName = "companyName1429880077", 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(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); string formattedParent = new ProjectName("[PROJECT]").ToString(); Job job = new Job(); Job response = client.CreateJob(formattedParent, job); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }