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

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

            mockGrpcClient.Setup(x => x.GetEntityType(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            EntityTypesClient client       = new EntityTypesClientImpl(mockGrpcClient.Object, null);
            EntityTypeName    name         = new EntityTypeName("[PROJECT]", "[ENTITY_TYPE]");
            string            languageCode = "languageCode-412800396";
            EntityType        response     = client.GetEntityType(name, languageCode);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateEntityType()
        {
            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(),
            };
            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();
            EntityType        response   = client.UpdateEntityType(entityType);

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

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

            mockGrpcClient.Setup(x => x.GetEntityTypeAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <EntityType>(Task.FromResult(expectedResponse), null, null, null, null));
            EntityTypesClient client   = new EntityTypesClientImpl(mockGrpcClient.Object, null);
            EntityTypeName    name     = new EntityTypeName("[PROJECT]", "[ENTITY_TYPE]");
            EntityType        response = await client.GetEntityTypeAsync(name);

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

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

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

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

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

            mockGrpcClient.Setup(x => x.CreateEntityTypeAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <EntityType>(Task.FromResult(expectedResponse), null, null, null, null));
            EntityTypesClient client       = new EntityTypesClientImpl(mockGrpcClient.Object, null);
            ProjectAgentName  parent       = new ProjectAgentName("[PROJECT]");
            EntityType        entityType   = new EntityType();
            string            languageCode = "languageCode-412800396";
            EntityType        response     = await client.CreateEntityTypeAsync(parent, entityType, languageCode);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #6
0
        public async stt::Task GetEntityTypeRequestObjectAsync()
        {
            moq::Mock <EntityTypes.EntityTypesClient> mockGrpcClient = new moq::Mock <EntityTypes.EntityTypesClient>(moq::MockBehavior.Strict);
            GetEntityTypeRequest request = new GetEntityTypeRequest
            {
                EntityTypeName = EntityTypeName.FromProjectLocationAgentEntityType("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"),
                LanguageCode   = "language_code2f6c7160",
            };
            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.GetEntityTypeAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <EntityType>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            EntityTypesClient client = new EntityTypesClientImpl(mockGrpcClient.Object, null);
            EntityType        responseCallSettings = await client.GetEntityTypeAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Пример #7
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();
        }
Пример #8
0
        public void CreateEntityTypeRequestObject()
        {
            moq::Mock <EntityTypes.EntityTypesClient> mockGrpcClient = new moq::Mock <EntityTypes.EntityTypesClient>(moq::MockBehavior.Strict);
            CreateEntityTypeRequest request = new CreateEntityTypeRequest
            {
                ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
                EntityType        = new EntityType(),
                LanguageCode      = "language_code2f6c7160",
            };
            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,
                Redact = true,
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #9
0
        public void DeleteEntityTypeResourceNames()
        {
            moq::Mock <EntityTypes.EntityTypesClient> mockGrpcClient = new moq::Mock <EntityTypes.EntityTypesClient>(moq::MockBehavior.Strict);
            DeleteEntityTypeRequest request = new DeleteEntityTypeRequest
            {
                EntityTypeName = EntityTypeName.FromProjectLocationAgentEntityType("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

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

            client.DeleteEntityType(request.EntityTypeName);
            mockGrpcClient.VerifyAll();
        }
Пример #10
0
        public async stt::Task DeleteEntityTypeResourceNamesAsync()
        {
            moq::Mock <EntityTypes.EntityTypesClient> mockGrpcClient = new moq::Mock <EntityTypes.EntityTypesClient>(moq::MockBehavior.Strict);
            DeleteEntityTypeRequest request = new DeleteEntityTypeRequest
            {
                EntityTypeName = EntityTypeName.FromProjectLocationAgentEntityType("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteEntityTypeAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            EntityTypesClient client = new EntityTypesClientImpl(mockGrpcClient.Object, null);
            await client.DeleteEntityTypeAsync(request.EntityTypeName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeleteEntityTypeAsync(request.EntityTypeName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
        public async Task DeleteEntityTypeAsync2()
        {
            Mock <EntityTypes.EntityTypesClient> mockGrpcClient = new Mock <EntityTypes.EntityTypesClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            DeleteEntityTypeRequest request = new DeleteEntityTypeRequest
            {
                EntityTypeName = new EntityTypeName("[PROJECT]", "[ENTITY_TYPE]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteEntityTypeAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            EntityTypesClient client = new EntityTypesClientImpl(mockGrpcClient.Object, null);
            await client.DeleteEntityTypeAsync(request);

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

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            DeleteEntityTypeRequest request = new DeleteEntityTypeRequest
            {
                EntityTypeName = new EntityTypeName("[PROJECT]", "[ENTITY_TYPE]"),
            };
            Empty expectedResponse = new Empty();

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

            client.DeleteEntityType(request);
            mockGrpcClient.VerifyAll();
        }