public void TestComponents() { var stencil = new TestStencil(); var source = new List <ITypeMetadata> { stencil.GenerateTypeHandle(typeof(TestComponent)).GetMetadata(stencil), stencil.GenerateTypeHandle(typeof(TestSharedComponent)).GetMetadata(stencil), stencil.GenerateTypeHandle(typeof(string)).GetMetadata(stencil) }; var db = new EcsTypeSearcherDatabase(stencil, source).AddComponents().Build(); ValidateHierarchy(db.Search("", out _), new[] { new SearcherItem("Component Data", "", new List <SearcherItem> { new SearcherItem("UnityEditor", "", new List <SearcherItem> { new SearcherItem("VisualScriptingECSTests", "", new List <SearcherItem> { new SearcherItem("Stencils", "", new List <SearcherItem> { new TypeSearcherItem( typeof(TestComponent).GenerateTypeHandle(stencil), typeof(TestComponent).FriendlyName() ) }) }) }) }), new SearcherItem("Shared Component Data", "", new List <SearcherItem> { new SearcherItem("UnityEditor", "", new List <SearcherItem> { new SearcherItem("VisualScriptingECSTests", "", new List <SearcherItem> { new SearcherItem("Stencils", "", new List <SearcherItem> { new TypeSearcherItem( typeof(TestSharedComponent).GenerateTypeHandle(stencil), typeof(TestSharedComponent).FriendlyName() ) }) }) }) }) }); }
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 EcsTypeSearcherDatabase(Stencil, new List <ITypeMetadata>()) .AddGraphs() .Build(); var result = db.Search(graphName, out _); Assert.AreEqual(expectedResult, result.Count); AssetDatabase.DeleteAsset(path); }