public async Task UpdateJobAsync() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); UpdateJobRequest expectedRequest = new UpdateJobRequest { 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.UpdateJobAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Job>(Task.FromResult(expectedResponse), null, null, null, null)); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); Job job = new Job(); Job response = await client.UpdateJobAsync(job); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task DeleteJobAsync2() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); DeleteJobRequest request = new DeleteJobRequest { JobNameOneof = JobNameOneof.From(new JobOldName("[PROJECT]", "[JOBS]")), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteJobAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteJobAsync(request); mockGrpcClient.VerifyAll(); }
public void DeleteJob2() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); DeleteJobRequest request = new DeleteJobRequest { JobNameOneof = JobNameOneof.From(new JobOldName("[PROJECT]", "[JOBS]")), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteJob(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); client.DeleteJob(request); mockGrpcClient.VerifyAll(); }
public async Task BatchDeleteJobsAsync2() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); BatchDeleteJobsRequest request = new BatchDeleteJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Filter = "filter-1274492040", }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.BatchDeleteJobsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); await client.BatchDeleteJobsAsync(request); mockGrpcClient.VerifyAll(); }
public void BatchDeleteJobs2() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); BatchDeleteJobsRequest request = new BatchDeleteJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Filter = "filter-1274492040", }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.BatchDeleteJobs(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); client.BatchDeleteJobs(request); mockGrpcClient.VerifyAll(); }
public void DeleteJob() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); DeleteJobRequest expectedRequest = new DeleteJobRequest { Name = new JobName("[PROJECT]", "[JOB]").ToString(), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteJob(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); string formattedName = new JobName("[PROJECT]", "[JOB]").ToString(); client.DeleteJob(formattedName); mockGrpcClient.VerifyAll(); }
public void BatchDeleteJobs() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); BatchDeleteJobsRequest expectedRequest = new BatchDeleteJobsRequest { ParentAsProjectName = new ProjectName("[PROJECT]"), Filter = "filter-1274492040", }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.BatchDeleteJobs(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); ProjectName parent = new ProjectName("[PROJECT]"); string filter = "filter-1274492040"; client.BatchDeleteJobs(parent, filter); mockGrpcClient.VerifyAll(); }
public async Task BatchDeleteJobsAsync() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); BatchDeleteJobsRequest expectedRequest = new BatchDeleteJobsRequest { Parent = new ProjectName("[PROJECT]").ToString(), Filter = "filter-1274492040", }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.BatchDeleteJobsAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); string formattedParent = new ProjectName("[PROJECT]").ToString(); string filter = "filter-1274492040"; await client.BatchDeleteJobsAsync(formattedParent, filter); mockGrpcClient.VerifyAll(); }