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; }
public void ThrowArgumentNullException_WhenAllParametersAreNull() { // Arrange IShouldCacheInvocationReturnValueStrategy shouldCacheInvocationReturnValueStrategy = null; ICachingInterceptor decoratedCachingInterceptor = null; // Act & Assert Assert.That( () => new ManagedCachingInterceptor(shouldCacheInvocationReturnValueStrategy, decoratedCachingInterceptor), Throws.InstanceOf <ArgumentNullException>()); }
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))); }