using System.Collections; using System.Collections.Generic; using NUnit.Framework; using UnityEngine; using UnityEngine.TestTools; using com.bbbirder; using bt_it; public class BasicTests { static void AssertCount(int count) where T : DirectRetrieveAttribute { var al = Retriever.GetAllAttributes(typeof(BasicTests).Assembly); Assert.AreEqual(count, al.Length); } static void AssertSubTypeCount(int count) { var sl = Retriever.GetAllSubtypes(typeof(T), typeof(BasicTests).Assembly); Assert.AreEqual(count, sl.Length); } // A Test behaves as an ordinary method [Test] public void TestGenerics() { AssertCount(4); } [Test] public void TestNest() { AssertCount(3); } [Test] public void TestBaseType() { AssertSubTypeCount(5); } [Test] public void TestInterface() { AssertSubTypeCount(4); } [Test] public void TestEnum() { AssertCount(2); } } class EnumAttribute : DirectRetrieveAttribute { } class TGAttribute : DirectRetrieveAttribute { } class INNAttribute : DirectRetrieveAttribute { } namespace innerA.innerB { public class TestClassA { [TG] public void Bar(T t) { } [TG] public void Foo(G g) { } [TG] public void Foo2(G g) { } } [TG] internal class TestGenericB { [INN] internal class Inner { [INN] static void Bar() { } [INN] internal class Far { } } } } namespace bt_it { enum FooEnum { Default, Foo, [Enum] Bar, [Enum] Baz, Length, } class MyBaseType : IDirectRetrieve { } class SubA : MyBaseType { internal class SubA_A : MyBaseType { } } class SubB : SubA { } class SubC : SubA { } class SubD : SubB { } interface IMyInterface : IDirectRetrieve { } class ImpA : IMyInterface { internal class ImpA_A : IMyInterface { } } class ImpB : ImpA { } struct ImpS : IMyInterface { } }