public async stt::Task ReportPhishingAsync() { moq::Mock <PhishingProtectionServiceV1Beta1.PhishingProtectionServiceV1Beta1Client> mockGrpcClient = new moq::Mock <PhishingProtectionServiceV1Beta1.PhishingProtectionServiceV1Beta1Client>(moq::MockBehavior.Strict); ReportPhishingRequest request = new ReportPhishingRequest { ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"), Uri = "uri3db70593", }; ReportPhishingResponse expectedResponse = new ReportPhishingResponse { }; mockGrpcClient.Setup(x => x.ReportPhishingAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ReportPhishingResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); PhishingProtectionServiceV1Beta1Client client = new PhishingProtectionServiceV1Beta1ClientImpl(mockGrpcClient.Object, null); ReportPhishingResponse responseCallSettings = await client.ReportPhishingAsync(request.Parent, request.Uri, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ReportPhishingResponse responseCancellationToken = await client.ReportPhishingAsync(request.Parent, request.Uri, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task ReportPhishingAsync2() { Mock <PhishingProtectionServiceV1Beta1.PhishingProtectionServiceV1Beta1Client> mockGrpcClient = new Mock <PhishingProtectionServiceV1Beta1.PhishingProtectionServiceV1Beta1Client>(MockBehavior.Strict); ReportPhishingRequest request = new ReportPhishingRequest { ParentAsProjectName = new ProjectName("[PROJECT]"), Uri = "uri116076", }; ReportPhishingResponse expectedResponse = new ReportPhishingResponse(); mockGrpcClient.Setup(x => x.ReportPhishingAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ReportPhishingResponse>(Task.FromResult(expectedResponse), null, null, null, null)); PhishingProtectionServiceV1Beta1Client client = new PhishingProtectionServiceV1Beta1ClientImpl(mockGrpcClient.Object, null); ReportPhishingResponse response = await client.ReportPhishingAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }