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();
        }
        public void GetModel2()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetModelRequest request = new GetModelRequest
            {
                ModelName = new ModelName("[PROJECT]", "[LOCATION]", "[MODEL]"),
            };
            Model expectedResponse = new Model
            {
                Name        = "name2-1052831874",
                DisplayName = "displayName1615086568",
                DatasetId   = "datasetId-2115646910",
            };

            mockGrpcClient.Setup(x => x.GetModel(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Model        response = client.GetModel(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 3
0
        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 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();
        }
Exemplo n.º 5
0
        public async Task CreateDatasetAsync()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            CreateDatasetRequest expectedRequest = new CreateDatasetRequest
            {
                ParentAsLocationName = new LocationName("[PROJECT]", "[LOCATION]"),
                Dataset = new Dataset(),
            };
            Operation expectedResponse = new Operation
            {
                Name = "name3373707",
                Done = true,
            };

            mockGrpcClient.Setup(x => x.CreateDatasetAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Operation>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            LocationName parent   = new LocationName("[PROJECT]", "[LOCATION]");
            Dataset      dataset  = new Dataset();
            Operation    response = await client.CreateDatasetAsync(parent, dataset);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task UpdateModelAsync2()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            UpdateModelRequest request = new UpdateModelRequest
            {
                Model      = new Model(),
                UpdateMask = new FieldMask(),
            };
            Model expectedResponse = new Model
            {
                Name        = "name3373707",
                DisplayName = "displayName1615086568",
                DatasetId   = "datasetId-2115646910",
                Etag        = "etag3123477",
            };

            mockGrpcClient.Setup(x => x.UpdateModelAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Model>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Model        response = await client.UpdateModelAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task UpdateDatasetAsync()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            UpdateDatasetRequest expectedRequest = new UpdateDatasetRequest
            {
                Dataset    = new Dataset(),
                UpdateMask = new FieldMask(),
            };
            Dataset expectedResponse = new Dataset
            {
                Name         = "name3373707",
                DisplayName  = "displayName1615086568",
                Description  = "description-1724546052",
                ExampleCount = 1517063674,
                Etag         = "etag3123477",
            };

            mockGrpcClient.Setup(x => x.UpdateDatasetAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Dataset>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient client     = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Dataset      dataset    = new Dataset();
            FieldMask    updateMask = new FieldMask();
            Dataset      response   = await client.UpdateDatasetAsync(dataset, updateMask);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetModelAsync2()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetModelRequest request = new GetModelRequest
            {
                ModelName = new ModelName("[PROJECT]", "[LOCATION]", "[MODEL]"),
            };
            Model expectedResponse = new Model
            {
                Name        = "name2-1052831874",
                DisplayName = "displayName1615086568",
                DatasetId   = "datasetId-2115646910",
                Etag        = "etag3123477",
            };

            mockGrpcClient.Setup(x => x.GetModelAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Model>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Model        response = await client.GetModelAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateModel()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            UpdateModelRequest expectedRequest = new UpdateModelRequest
            {
                Model      = new Model(),
                UpdateMask = new FieldMask(),
            };
            Model expectedResponse = new Model
            {
                Name        = "name3373707",
                DisplayName = "displayName1615086568",
                DatasetId   = "datasetId-2115646910",
                Etag        = "etag3123477",
            };

            mockGrpcClient.Setup(x => x.UpdateModel(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AutoMlClient client     = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Model        model      = new Model();
            FieldMask    updateMask = new FieldMask();
            Model        response   = client.UpdateModel(model, updateMask);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetDatasetAsync2()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetDatasetRequest request = new GetDatasetRequest
            {
                DatasetName = new DatasetName("[PROJECT]", "[LOCATION]", "[DATASET]"),
            };
            Dataset expectedResponse = new Dataset
            {
                Name         = "name2-1052831874",
                DisplayName  = "displayName1615086568",
                Description  = "description-1724546052",
                ExampleCount = 1517063674,
                Etag         = "etag3123477",
            };

            mockGrpcClient.Setup(x => x.GetDatasetAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Dataset>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Dataset      response = await client.GetDatasetAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetAnnotationSpecAsync2()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetAnnotationSpecRequest request = new GetAnnotationSpecRequest
            {
                AnnotationSpecName = new AnnotationSpecName("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"),
            };
            AnnotationSpec expectedResponse = new AnnotationSpec
            {
                Name         = "name2-1052831874",
                DisplayName  = "displayName1615086568",
                ExampleCount = 1517063674,
            };

            mockGrpcClient.Setup(x => x.GetAnnotationSpecAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <AnnotationSpec>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient   client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            AnnotationSpec response = await client.GetAnnotationSpecAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 12
0
        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 void UpdateDataset2()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            UpdateDatasetRequest request = new UpdateDatasetRequest
            {
                Dataset    = new Dataset(),
                UpdateMask = new FieldMask(),
            };
            Dataset expectedResponse = new Dataset
            {
                Name         = "name3373707",
                DisplayName  = "displayName1615086568",
                Description  = "description-1724546052",
                ExampleCount = 1517063674,
                Etag         = "etag3123477",
            };

            mockGrpcClient.Setup(x => x.UpdateDataset(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Dataset      response = client.UpdateDataset(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 14
0
        public async stt::Task GetAnnotationSpecRequestObjectAsync()
        {
            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);
            GetAnnotationSpecRequest request = new GetAnnotationSpecRequest
            {
                Name = "name1c9368b0",
            };
            AnnotationSpec expectedResponse = new AnnotationSpec
            {
                Name         = "name1c9368b0",
                DisplayName  = "display_name137f65c2",
                ExampleCount = -1179891861,
            };

            mockGrpcClient.Setup(x => x.GetAnnotationSpecAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AnnotationSpec>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient   client = new AutoMlClientImpl(mockGrpcClient.Object, null);
            AnnotationSpec responseCallSettings = await client.GetAnnotationSpecAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            AnnotationSpec responseCancellationToken = await client.GetAnnotationSpecAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 15
0
        public void CreateDataset2()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            CreateDatasetRequest request = new CreateDatasetRequest
            {
                ParentAsLocationName = new LocationName("[PROJECT]", "[LOCATION]"),
                Dataset = new Dataset(),
            };
            Operation expectedResponse = new Operation
            {
                Name = "name3373707",
                Done = true,
            };

            mockGrpcClient.Setup(x => x.CreateDataset(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Operation    response = client.CreateDataset(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 16
0
        public async stt::Task UpdateModelRequestObjectAsync()
        {
            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);
            UpdateModelRequest request = new UpdateModelRequest
            {
                Model      = new Model(),
                UpdateMask = new wkt::FieldMask(),
            };
            Model expectedResponse = new Model
            {
                ModelName       = ModelName.FromProjectLocationModel("[PROJECT_ID]", "[LOCATION_ID]", "[MODEL_ID]"),
                DisplayName     = "display_name137f65c2",
                DatasetId       = "dataset_id08d366d3",
                CreateTime      = new wkt::Timestamp(),
                DeploymentState = Model.Types.DeploymentState.Deployed,
                Etag            = "etage8ad7218",
                UpdateTime      = new wkt::Timestamp(),
                ImageClassificationModelMetadata  = new ImageClassificationModelMetadata(),
                TextClassificationModelMetadata   = new TextClassificationModelMetadata(),
                TranslationModelMetadata          = new TranslationModelMetadata(),
                TextExtractionModelMetadata       = new TextExtractionModelMetadata(),
                ImageObjectDetectionModelMetadata = new ImageObjectDetectionModelMetadata(),
                TextSentimentModelMetadata        = new TextSentimentModelMetadata(),
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
            };

            mockGrpcClient.Setup(x => x.UpdateModelAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Model>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient client = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Model        responseCallSettings = await client.UpdateModelAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Model responseCancellationToken = await client.UpdateModelAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 17
0
        public async stt::Task UpdateDatasetRequestObjectAsync()
        {
            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);
            UpdateDatasetRequest request = new UpdateDatasetRequest
            {
                Dataset    = new Dataset(),
                UpdateMask = new wkt::FieldMask(),
            };
            Dataset expectedResponse = new Dataset
            {
                Name         = "name1c9368b0",
                DisplayName  = "display_name137f65c2",
                Description  = "description2cf9da67",
                CreateTime   = new wkt::Timestamp(),
                Etag         = "etage8ad7218",
                ExampleCount = -1179891861,
                TranslationDatasetMetadata          = new TranslationDatasetMetadata(),
                ImageClassificationDatasetMetadata  = new ImageClassificationDatasetMetadata(),
                TextClassificationDatasetMetadata   = new TextClassificationDatasetMetadata(),
                ImageObjectDetectionDatasetMetadata = new ImageObjectDetectionDatasetMetadata(),
                TextExtractionDatasetMetadata       = new TextExtractionDatasetMetadata(),
                TextSentimentDatasetMetadata        = new TextSentimentDatasetMetadata(),
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
            };

            mockGrpcClient.Setup(x => x.UpdateDatasetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Dataset>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient client = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Dataset      responseCallSettings = await client.UpdateDatasetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Dataset responseCancellationToken = await client.UpdateDatasetAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 18
0
        public void GetModelRequestObject()
        {
            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);
            GetModelRequest request = new GetModelRequest
            {
                Name = "name1c9368b0",
            };
            Model expectedResponse = new Model
            {
                ModelName       = ModelName.FromProjectLocationModel("[PROJECT_ID]", "[LOCATION_ID]", "[MODEL_ID]"),
                DisplayName     = "display_name137f65c2",
                DatasetId       = "dataset_id08d366d3",
                CreateTime      = new wkt::Timestamp(),
                DeploymentState = Model.Types.DeploymentState.Deployed,
                Etag            = "etage8ad7218",
                UpdateTime      = new wkt::Timestamp(),
                ImageClassificationModelMetadata  = new ImageClassificationModelMetadata(),
                TextClassificationModelMetadata   = new TextClassificationModelMetadata(),
                TranslationModelMetadata          = new TranslationModelMetadata(),
                TextExtractionModelMetadata       = new TextExtractionModelMetadata(),
                ImageObjectDetectionModelMetadata = new ImageObjectDetectionModelMetadata(),
                TextSentimentModelMetadata        = new TextSentimentModelMetadata(),
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
            };

            mockGrpcClient.Setup(x => x.GetModel(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Model        response = client.GetModel(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 19
0
        public void GetDatasetRequestObject()
        {
            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);
            GetDatasetRequest request = new GetDatasetRequest
            {
                Name = "name1c9368b0",
            };
            Dataset expectedResponse = new Dataset
            {
                Name         = "name1c9368b0",
                DisplayName  = "display_name137f65c2",
                Description  = "description2cf9da67",
                CreateTime   = new wkt::Timestamp(),
                Etag         = "etage8ad7218",
                ExampleCount = -1179891861,
                TranslationDatasetMetadata          = new TranslationDatasetMetadata(),
                ImageClassificationDatasetMetadata  = new ImageClassificationDatasetMetadata(),
                TextClassificationDatasetMetadata   = new TextClassificationDatasetMetadata(),
                ImageObjectDetectionDatasetMetadata = new ImageObjectDetectionDatasetMetadata(),
                TextExtractionDatasetMetadata       = new TextExtractionDatasetMetadata(),
                TextSentimentDatasetMetadata        = new TextSentimentDatasetMetadata(),
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
            };

            mockGrpcClient.Setup(x => x.GetDataset(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Dataset      response = client.GetDataset(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 20
0
        public void GetAnnotationSpecRequestObject()
        {
            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);
            GetAnnotationSpecRequest request = new GetAnnotationSpecRequest
            {
                Name = "name1c9368b0",
            };
            AnnotationSpec expectedResponse = new AnnotationSpec
            {
                Name         = "name1c9368b0",
                DisplayName  = "display_name137f65c2",
                ExampleCount = -1179891861,
            };

            mockGrpcClient.Setup(x => x.GetAnnotationSpec(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoMlClient   client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            AnnotationSpec response = client.GetAnnotationSpec(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }