コード例 #1
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();
        }
コード例 #2
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();
        }