Esempio n. 1
0
        public ManagedCachingInterceptor(IShouldCacheInvocationReturnValueStrategy shouldCacheInvocationReturnValueStrategy, ICachingInterceptor decoratedCachingInterceptor)
        {
            Guard.WhenArgument(shouldCacheInvocationReturnValueStrategy, nameof(IShouldCacheInvocationReturnValueStrategy)).IsNull().Throw();
            Guard.WhenArgument(decoratedCachingInterceptor, nameof(ICachingInterceptor)).IsNull().Throw();

            this.shouldCacheInvocationReturnValueStrategy = shouldCacheInvocationReturnValueStrategy;
            this.decoratedCachingInterceptor = decoratedCachingInterceptor;
        }
Esempio n. 2
0
        public void ThrowArgumentNullException_WhenAllParametersAreNull()
        {
            // Arrange
            IShouldCacheInvocationReturnValueStrategy shouldCacheInvocationReturnValueStrategy = null;
            ICachingInterceptor decoratedCachingInterceptor = null;

            // Act & Assert
            Assert.That(
                () => new ManagedCachingInterceptor(shouldCacheInvocationReturnValueStrategy, decoratedCachingInterceptor),
                Throws.InstanceOf <ArgumentNullException>());
        }
Esempio n. 3
0
        public void ThrowArgumentNullException_WhenICachingInterceptorParameterIsNull()
        {
            // Arrange
            var shouldCacheInvocationReturnValueStrategy    = new Mock <IShouldCacheInvocationReturnValueStrategy>();
            ICachingInterceptor decoratedCachingInterceptor = null;

            // Act & Assert
            Assert.That(
                () => new ManagedCachingInterceptor(shouldCacheInvocationReturnValueStrategy.Object, decoratedCachingInterceptor),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains(nameof(ICachingInterceptor)));
        }