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_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))); }