public void AnnotateAssessmentResourceNames() { moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient>(moq::MockBehavior.Strict); AnnotateAssessmentRequest request = new AnnotateAssessmentRequest { AssessmentName = AssessmentName.FromProjectAssessment("[PROJECT]", "[ASSESSMENT]"), Annotation = AnnotateAssessmentRequest.Types.Annotation.PasswordCorrect, }; AnnotateAssessmentResponse expectedResponse = new AnnotateAssessmentResponse { }; mockGrpcClient.Setup(x => x.AnnotateAssessment(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null); AnnotateAssessmentResponse response = client.AnnotateAssessment(request.AssessmentName, request.Annotation); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void AnnotateAssessmentRequestObject() { moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient>(moq::MockBehavior.Strict); AnnotateAssessmentRequest request = new AnnotateAssessmentRequest { AssessmentName = AssessmentName.FromProjectAssessment("[PROJECT]", "[ASSESSMENT]"), Annotation = AnnotateAssessmentRequest.Types.Annotation.PasswordCorrect, Reasons = { AnnotateAssessmentRequest.Types.Reason.InitiatedTwoFactor, }, HashedAccountId = proto::ByteString.CopyFromUtf8("hashed_account_id016ad986"), }; AnnotateAssessmentResponse expectedResponse = new AnnotateAssessmentResponse { }; mockGrpcClient.Setup(x => x.AnnotateAssessment(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null); AnnotateAssessmentResponse response = client.AnnotateAssessment(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }