public async stt::Task DeleteJobAsync() { moq::Mock <JobController.JobControllerClient> mockGrpcClient = new moq::Mock <JobController.JobControllerClient>(moq::MockBehavior.Strict); DeleteJobRequest request = new DeleteJobRequest { ProjectId = "project_id43ad98b0", JobId = "job_id38ea97d6", Region = "regionedb20d96", }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteJobAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); JobControllerClient client = new JobControllerClientImpl(mockGrpcClient.Object, null); await client.DeleteJobAsync(request.ProjectId, request.Region, request.JobId, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteJobAsync(request.ProjectId, request.Region, request.JobId, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
public async Task DeleteJobAsync2() { Mock <JobController.JobControllerClient> mockGrpcClient = new Mock <JobController.JobControllerClient>(MockBehavior.Strict); DeleteJobRequest request = new DeleteJobRequest { ProjectId = "projectId-1969970175", Region = "region-934795532", JobId = "jobId-1154752291", }; 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)); JobControllerClient client = new JobControllerClientImpl(mockGrpcClient.Object, null); await client.DeleteJobAsync(request); mockGrpcClient.VerifyAll(); }