コード例 #1
0
        public void GetCacheKey_WhenItemHasMultilevelCircularBaseLayoutReference_ThrowsCircularReferenceException()
        {
            // Arrange
            var cache = new BaseLayoutValueCache(TestUtil.CreateFakeSettings());
            var id = new ID();
            var baseId = new ID();
            var baseItem = MasterFakesFactory.CreateFakeItem(baseId, null, null, null, id);
            var item = MasterFakesFactory.CreateFakeItem(id, null, null, null, baseId);

            // Act => Assert
            Assert.Throws<CircularReferenceException>(() => cache.GetCacheKey(item));
        }
コード例 #2
0
        public void GetCacheKey_WithoutCircularReference_ReturnsKeyThatEndsWithItemId()
        {
            // Arrange
            var cache = new BaseLayoutValueCache(TestUtil.CreateFakeSettings());
            var item1 = MasterFakesFactory.CreateFakeItem();
            var item2 = MasterFakesFactory.CreateFakeItem(null, null, null, null, item1.ID);

            // Act
            var result = cache.GetCacheKey(item2);

            // Assert
            Assert.True(result.EndsWith(item2.ID.ToString(), StringComparison.OrdinalIgnoreCase));
        }