public void UpdateEntityType3()
        {
            Mock <EntityTypes.EntityTypesClient> mockGrpcClient = new Mock <EntityTypes.EntityTypesClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            UpdateEntityTypeRequest request = new UpdateEntityTypeRequest
            {
                EntityType = new EntityType(),
            };
            EntityType expectedResponse = new EntityType
            {
                EntityTypeName        = new EntityTypeName("[PROJECT]", "[ENTITY_TYPE]"),
                DisplayName           = "displayName1615086568",
                EnableFuzzyExtraction = true,
            };

            mockGrpcClient.Setup(x => x.UpdateEntityType(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            EntityTypesClient client   = new EntityTypesClientImpl(mockGrpcClient.Object, null);
            EntityType        response = client.UpdateEntityType(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateEntityType2()
        {
            Mock <EntityTypes.EntityTypesClient> mockGrpcClient = new Mock <EntityTypes.EntityTypesClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            UpdateEntityTypeRequest expectedRequest = new UpdateEntityTypeRequest
            {
                EntityType   = new EntityType(),
                LanguageCode = "languageCode-412800396",
            };
            EntityType expectedResponse = new EntityType
            {
                EntityTypeName = new EntityTypeName("[PROJECT]", "[ENTITY_TYPE]"),
                DisplayName    = "displayName1615086568",
            };

            mockGrpcClient.Setup(x => x.UpdateEntityType(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            EntityTypesClient client       = new EntityTypesClientImpl(mockGrpcClient.Object, null);
            EntityType        entityType   = new EntityType();
            string            languageCode = "languageCode-412800396";
            EntityType        response     = client.UpdateEntityType(entityType, languageCode);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #3
0
        public void UpdateEntityType()
        {
            moq::Mock <EntityTypes.EntityTypesClient> mockGrpcClient = new moq::Mock <EntityTypes.EntityTypesClient>(moq::MockBehavior.Strict);
            UpdateEntityTypeRequest request = new UpdateEntityTypeRequest
            {
                EntityType = new EntityType(),
                UpdateMask = new wkt::FieldMask(),
            };
            EntityType expectedResponse = new EntityType
            {
                EntityTypeName    = EntityTypeName.FromProjectLocationAgentEntityType("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"),
                DisplayName       = "display_name137f65c2",
                Kind              = EntityType.Types.Kind.Regexp,
                AutoExpansionMode = EntityType.Types.AutoExpansionMode.Default,
                Entities          =
                {
                    new EntityType.Types.Entity(),
                },
                ExcludedPhrases =
                {
                    new EntityType.Types.ExcludedPhrase(),
                },
                EnableFuzzyExtraction = false,
            };

            mockGrpcClient.Setup(x => x.UpdateEntityType(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            EntityTypesClient client   = new EntityTypesClientImpl(mockGrpcClient.Object, null);
            EntityType        response = client.UpdateEntityType(request.EntityType, request.UpdateMask);

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