示例#1
0
        public void Test_Creation()
        {
            TenantEntityCache tenantEntityCache;
            const string      testAlias     = "bar";
            const string      testNamespace = "foo";

            tenantEntityCache = new TenantEntityCache(testNamespace, testAlias);
            Assert.That(tenantEntityCache, Has.Property("EntityNamespace").EqualTo(testNamespace));
            Assert.That(tenantEntityCache, Has.Property("EntityAlias").EqualTo(testAlias));
            Assert.That(tenantEntityCache.TenantEntityMap.Keys, Has.Count.EqualTo(0));
        }
示例#2
0
        public void Test_Entity()
        {
            TenantEntityCache tenantEntityCache;
            const string      testAlias     = "resource";
            const string      testNamespace = "core";

            tenantEntityCache = new TenantEntityCache(testNamespace, testAlias);

            Assert.That(tenantEntityCache.EntityRef, Is.EqualTo(new EntityRef(testNamespace, testAlias)).Using(EntityRefComparer.Instance));
            Assert.That(tenantEntityCache.TenantEntityMap.Keys, Has.Count.EqualTo(1));
            Assert.That(tenantEntityCache.TenantEntityMap.Keys, Has.Exactly(1).EqualTo(RequestContext.TenantId));
            Assert.That(tenantEntityCache.TenantEntityMap[RequestContext.TenantId],
                        Is.EqualTo(new EntityRef(testNamespace, testAlias)).Using(EntityRefComparer.Instance));
        }