コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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();
        }
コード例 #7
0
        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();
        }
コード例 #8
0
        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();
        }