public void UpdateModel2()
        {
            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.UpdateModel(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Model        response = client.UpdateModel(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #2
0
        public void UpdateModelRequestObject()
        {
            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.UpdateModel(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoMlClient client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            Model        response = client.UpdateModel(request);

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