实体列表缓存,内部改用数组,避免出现遍历时列表被修改的尴尬情况发生。单元测试通过
大石头 authored at 2019-09-12 11:14:53
508.00 B
X
using System;
using XCode.Membership;
using Xunit;

namespace XUnitTest.XCode
{
    public class EntityCacheTest
    {
        [Fact]
        public void TestAddRemove()
        {
            var cache = Role.Meta.Cache;
            var count = cache.Entities.Count;

            var r = new Role { Name = "test" };

            cache.Add(r);
            Assert.Equal(count + 1, cache.Entities.Count);

            cache.Remove(r);
            Assert.Equal(count, cache.Entities.Count);
        }
    }
}