public async stt::Task GetModelEvaluationRequestObjectAsync() { moq::Mock <AutoMl.AutoMlClient> mockGrpcClient = new moq::Mock <AutoMl.AutoMlClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetModelEvaluationRequest request = new GetModelEvaluationRequest { Name = "name1c9368b0", }; ModelEvaluation expectedResponse = new ModelEvaluation { Name = "name1c9368b0", AnnotationSpecId = "annotation_spec_ide0c3e8b2", CreateTime = new wkt::Timestamp(), EvaluatedExampleCount = -1119926106, ClassificationEvaluationMetrics = new ClassificationEvaluationMetrics(), TranslationEvaluationMetrics = new TranslationEvaluationMetrics(), TextSentimentEvaluationMetrics = new TextSentimentEvaluationMetrics(), ImageObjectDetectionEvaluationMetrics = new ImageObjectDetectionEvaluationMetrics(), TextExtractionEvaluationMetrics = new TextExtractionEvaluationMetrics(), DisplayName = "display_name137f65c2", }; mockGrpcClient.Setup(x => x.GetModelEvaluationAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ModelEvaluation>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AutoMlClient client = new AutoMlClientImpl(mockGrpcClient.Object, null); ModelEvaluation responseCallSettings = await client.GetModelEvaluationAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ModelEvaluation responseCancellationToken = await client.GetModelEvaluationAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task GetModelEvaluationAsync2() { Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); GetModelEvaluationRequest request = new GetModelEvaluationRequest { ModelEvaluationName = new ModelEvaluationName("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]"), }; ModelEvaluation expectedResponse = new ModelEvaluation { Name = "name2-1052831874", AnnotationSpecId = "annotationSpecId60690191", DisplayName = "displayName1615086568", EvaluatedExampleCount = 277565350, }; mockGrpcClient.Setup(x => x.GetModelEvaluationAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ModelEvaluation>(Task.FromResult(expectedResponse), null, null, null, null)); AutoMlClient client = new AutoMlClientImpl(mockGrpcClient.Object, null); ModelEvaluation response = await client.GetModelEvaluationAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetModelEvaluationRequestObject() { moq::Mock <AutoMl.AutoMlClient> mockGrpcClient = new moq::Mock <AutoMl.AutoMlClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetModelEvaluationRequest request = new GetModelEvaluationRequest { Name = "name1c9368b0", }; ModelEvaluation expectedResponse = new ModelEvaluation { Name = "name1c9368b0", AnnotationSpecId = "annotation_spec_ide0c3e8b2", CreateTime = new wkt::Timestamp(), EvaluatedExampleCount = -1119926106, ClassificationEvaluationMetrics = new ClassificationEvaluationMetrics(), TranslationEvaluationMetrics = new TranslationEvaluationMetrics(), TextSentimentEvaluationMetrics = new TextSentimentEvaluationMetrics(), ImageObjectDetectionEvaluationMetrics = new ImageObjectDetectionEvaluationMetrics(), TextExtractionEvaluationMetrics = new TextExtractionEvaluationMetrics(), DisplayName = "display_name137f65c2", }; mockGrpcClient.Setup(x => x.GetModelEvaluation(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AutoMlClient client = new AutoMlClientImpl(mockGrpcClient.Object, null); ModelEvaluation response = client.GetModelEvaluation(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetModelEvaluation2() { Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); GetModelEvaluationRequest request = new GetModelEvaluationRequest { ModelEvaluationName = new ModelEvaluationName("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]"), }; ModelEvaluation expectedResponse = new ModelEvaluation { Name = "name2-1052831874", AnnotationSpecId = "annotationSpecId60690191", EvaluatedExampleCount = 277565350, }; mockGrpcClient.Setup(x => x.GetModelEvaluation(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AutoMlClient client = new AutoMlClientImpl(mockGrpcClient.Object, null); ModelEvaluation response = client.GetModelEvaluation(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetModelEvaluation</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetModelEvaluationRequestObject() { // Create client AutoMlClient autoMlClient = AutoMlClient.Create(); // Initialize request argument(s) GetModelEvaluationRequest request = new GetModelEvaluationRequest { ModelEvaluationName = ModelEvaluationName.FromProjectLocationModelModelEvaluation("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]"), }; // Make the request ModelEvaluation response = autoMlClient.GetModelEvaluation(request); }
/// <summary>Snippet for GetModelEvaluation</summary> public void GetModelEvaluationRequestObject() { // Snippet: GetModelEvaluation(GetModelEvaluationRequest, CallSettings) // Create client AutoMlClient autoMlClient = AutoMlClient.Create(); // Initialize request argument(s) GetModelEvaluationRequest request = new GetModelEvaluationRequest { Name = "", }; // Make the request ModelEvaluation response = autoMlClient.GetModelEvaluation(request); // End snippet }
/// <summary>Snippet for GetModelEvaluationAsync</summary> public async Task GetModelEvaluationRequestObjectAsync() { // Snippet: GetModelEvaluationAsync(GetModelEvaluationRequest, CallSettings) // Additional: GetModelEvaluationAsync(GetModelEvaluationRequest, CancellationToken) // Create client AutoMlClient autoMlClient = await AutoMlClient.CreateAsync(); // Initialize request argument(s) GetModelEvaluationRequest request = new GetModelEvaluationRequest { Name = "", }; // Make the request ModelEvaluation response = await autoMlClient.GetModelEvaluationAsync(request); // End snippet }