public void AsPolicy_TimeNull_Throws()
        {
            var logger   = new Mock <ILogger>(MockBehavior.Loose);
            var provider = new Mock <IAsyncCacheProvider <HttpResponseMessage> >(MockBehavior.Strict);
            var config   = new CacheConfig(provider.Object)
            {
                Time     = null,
                Absolute = false,
                Sliding  = false
            };

            Assert.ThrowsException <InvalidOperationException>(
                () => config.AsTypeModel(logger.Object));
        }
        public void AsPolicy_LoggerNull_Throws()
        {
            var provider = new Mock <IAsyncCacheProvider <HttpResponseMessage> >(MockBehavior.Strict);
            var config   = new CacheConfig(provider.Object)
            {
                Time = new CacheTime {
                    Days = 0, Hours = 0, Minutes = 5, Seconds = 0
                },
                Absolute = false,
                Sliding  = false
            };

            Assert.ThrowsException <ArgumentNullException>(
                () => config.AsTypeModel(null));
        }
        public void AsPolicy_Absolute_ReturnsPolicy()
        {
            var logger   = new Mock <ILogger>(MockBehavior.Loose);
            var provider = new Mock <IAsyncCacheProvider <HttpResponseMessage> >(MockBehavior.Strict);
            var config   = new CacheConfig(provider.Object)
            {
                Time = new CacheTime {
                    Days = 2, Hours = 0, Minutes = 5, Seconds = 0
                },
                Absolute = true,
                Sliding  = false
            };

            IAsyncPolicy <HttpResponseMessage> policy = config.AsTypeModel(logger.Object);

            Assert.IsNotNull(policy);
            Assert.IsInstanceOfType(policy, typeof(AsyncCachePolicy <HttpResponseMessage>));
        }