Exemplo n.º 1
0
        public void DacheMvcChildActionCache_Add_GivenValidInput_ShouldNotThrowException()
        {
            var cacheClient = new Mock <ICacheClient>();

            var dacheMvcChildActionCache = new DacheMvcChildActionCache(cacheClient.Object);

            dacheMvcChildActionCache.Add("test", new object(), DateTime.Now.AddDays(1));
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void DacheMvcChildActionCache_Constructor_GivenNullInput_ShouldThrowArgumentNullException()
        {
            try
            {
                var dacheMvcChildActionCache = new DacheMvcChildActionCache(null);
            }
            catch (ArgumentNullException)
            {
                // Good
                return;
            }

            Assert.Fail("ArgumentNullException was not thrown");
        }
Exemplo n.º 4
0
        public void DacheMvcChildActionCache_Add_GivenNullCacheKeyAndNullObject_ShouldThrowArgumentException()
        {
            var cacheClient = new Mock <ICacheClient>();

            var dacheMvcChildActionCache = new DacheMvcChildActionCache(cacheClient.Object);

            try
            {
                dacheMvcChildActionCache.Add(null, null, DateTime.Now.AddDays(1));
            }
            catch (ArgumentException)
            {
                // Good
                return;
            }

            Assert.Fail("ArgumentException was not thrown");
        }
Exemplo n.º 5
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");
        }
Exemplo n.º 6
0
        public void DacheMvcChildActionCache_Constructor_GivenValidInput_ShouldNotThrowException()
        {
            var cacheClient = new Mock <ICacheClient>();

            var dacheMvcChildActionCache = new DacheMvcChildActionCache(cacheClient.Object);
        }