示例#1
0
        public void DacheMvcChildActionCache_Get_GivenValidInputAndValueNotFoundInCache_ShouldReturnNull()
        {
            var    cacheClient = new Mock <ICacheClient>();
            object value       = null;

            cacheClient.Setup(i => i.TryGet <object>(It.IsAny <string>(), out value)).Returns(false);

            var dacheMvcChildActionCache = new DacheMvcChildActionCache(cacheClient.Object);

            var result = dacheMvcChildActionCache.Get("test");

            Assert.IsNull(result);
        }
示例#2
0
        public void DacheMvcChildActionCache_Get_GivenNullCacheKey_ShouldThrowArgumentException()
        {
            var cacheClient = new Mock <ICacheClient>();

            var dacheMvcChildActionCache = new DacheMvcChildActionCache(cacheClient.Object);

            try
            {
                dacheMvcChildActionCache.Get(null);
            }
            catch (ArgumentException)
            {
                // Good
                return;
            }

            Assert.Fail("ArgumentException was not thrown");
        }