Beispiel #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;
        }
Beispiel #2
0
        public void ThrowArgumentNullException_WhenAllParametersAreNull()
        {
            // Arrange
            IShouldCacheInvocationReturnValueStrategy shouldCacheInvocationReturnValueStrategy = null;
            ICachingInterceptor decoratedCachingInterceptor = null;

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

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