public void Interceptors_are_evaluated_in_order_they_are_added() { var compositeValueInterceptor = new CompositeValueInterceptor(); compositeValueInterceptor.Interceptors.Add(new Wrapper1Interceptor()); compositeValueInterceptor.Interceptors.Add(new Wrapper2Interceptor()); var val = "this is a value"; var interceptedValue = (IWrapper) compositeValueInterceptor.Intercept(val); Assert.That(interceptedValue.GetType(), Is.EqualTo(typeof(Wrapper2))); Assert.That(interceptedValue.Value.GetType(), Is.EqualTo(typeof(Wrapper1))); Assert.That(((IWrapper)interceptedValue.Value).Value, Is.EqualTo(val)); }
public void Interceptors_are_evaluated_in_order_they_are_added() { var compositeValueInterceptor = new CompositeValueInterceptor(); compositeValueInterceptor.Interceptors.Add(new Wrapper1Interceptor()); compositeValueInterceptor.Interceptors.Add(new Wrapper2Interceptor()); var val = "this is a value"; var interceptedValue = (IWrapper)compositeValueInterceptor.Intercept(val); Assert.That(interceptedValue.GetType(), Is.EqualTo(typeof(Wrapper2))); Assert.That(interceptedValue.Value.GetType(), Is.EqualTo(typeof(Wrapper1))); Assert.That(((IWrapper)interceptedValue.Value).Value, Is.EqualTo(val)); }