示例#1
0
    void when_caching()
    {
        before = () => {
            EntitasCache.Reset();
        };

        it["clears IComponent list"] = () => {
            var list = EntitasCache.GetIComponentList();
            list.Add(Component.A);
            EntitasCache.PushIComponentList(list);

            EntitasCache.GetIComponentList().Count.should_be(0);
        };

        it["clears int list"] = () => {
            var list = EntitasCache.GetIntList();
            list.Add(42);
            EntitasCache.PushIntList(list);

            EntitasCache.GetIntList().Count.should_be(0);
        };

        it["clears int hashSet"] = () => {
            var hashSet = EntitasCache.GetIntHashSet();
            hashSet.Add(42);
            EntitasCache.PushIntHashSet(hashSet);

            EntitasCache.GetIntHashSet().Count.should_be(0);
        };
    }
示例#2
0
    void when_caching()
    {
        before = () => {
            EntitasCache.Reset();
        };

        it["clears IComponent list"] = () => {
            var list = EntitasCache.GetIComponentList();
            list.Add(Component.A);
            EntitasCache.PushIComponentList(list);

            EntitasCache.GetIComponentList().Count.should_be(0);
        };

        it["clears int list"] = () => {
            var list = EntitasCache.GetIntList();
            list.Add(42);
            EntitasCache.PushIntList(list);

            EntitasCache.GetIntList().Count.should_be(0);
        };

        it["clears int hashSet"] = () => {
            var hashSet = EntitasCache.GetIntHashSet();
            hashSet.Add(42);
            EntitasCache.PushIntHashSet(hashSet);

            EntitasCache.GetIntHashSet().Count.should_be(0);
        };

        it["clears GroupChanged hashSet"] = () => {
            var list = EntitasCache.GetGroupChangedList <TestEntity>();
            list.Add((group, entity, index, component) => { });
            EntitasCache.PushGroupChangedList <TestEntity>(list);

            EntitasCache.GetGroupChangedList <TestEntity>().Count.should_be(0);
        };
    }