Exemplo n.º 1
0
        public void TestGraphs(Type stencilType, int expectedResult)
        {
            const string graphName = "TestGraphs";
            const string path      = "Assets/" + graphName + ".asset";

            m_Store.Dispatch(new CreateGraphAssetAction(stencilType, "TestGraph", path));

            var db = new TypeSearcherDatabase(Stencil, new List <ITypeMetadata>())
                     .AddGraphs()
                     .Build();

            var result = db.Search(graphName, out _);

            Assert.AreEqual(expectedResult, result.Count);

            AssetDatabase.DeleteAsset(path);
        }
Exemplo n.º 2
0
        public void TestEnums()
        {
            var source = new List <ITypeMetadata>
            {
                m_Stencil.GenerateTypeHandle(typeof(string)).GetMetadata(m_Stencil),
                m_Stencil.GenerateTypeHandle(typeof(MemberFlags)).GetMetadata(m_Stencil)
            };

            var db = new TypeSearcherDatabase(m_Stencil, source).AddEnums().Build();

            ValidateHierarchy(db.Search("", out _), new[]
            {
                new SearcherItem("Enumerations", "", new List <SearcherItem>
                {
                    new TypeSearcherItem(
                        typeof(MemberFlags).GenerateTypeHandle(m_Stencil),
                        typeof(MemberFlags).FriendlyName()
                        )
                })
            });
        }
Exemplo n.º 3
0
        public void TestClasses()
        {
            var source = new List <ITypeMetadata>
            {
                m_Stencil.GenerateTypeHandle(typeof(string)).GetMetadata(m_Stencil),
                m_Stencil.GenerateTypeHandle(typeof(ClassForTest)).GetMetadata(m_Stencil),
                m_Stencil.GenerateTypeHandle(typeof(MemberFlags)).GetMetadata(m_Stencil)
            };

            var db = new TypeSearcherDatabase(m_Stencil, source).AddClasses().Build();

            ValidateHierarchy(db.Search("", out _), new[]
            {
                new SearcherItem("Classes", "", new List <SearcherItem>
                {
                    new SearcherItem("System", "", new List <SearcherItem>
                    {
                        new TypeSearcherItem(
                            typeof(string).GenerateTypeHandle(m_Stencil),
                            typeof(string).FriendlyName()
                            )
                    }),
                    new SearcherItem("UnityEditor", "", new List <SearcherItem>
                    {
                        new SearcherItem("VisualScriptingTests", "", new List <SearcherItem>
                        {
                            new SearcherItem("SmartSearch", "", new List <SearcherItem>
                            {
                                new TypeSearcherItem(
                                    typeof(ClassForTest).GenerateTypeHandle(m_Stencil),
                                    typeof(ClassForTest).FriendlyName()
                                    )
                            })
                        })
                    })
                })
            });
        }