public void SetUp()
        {
            _interceptor1 = new MockTypeInterceptor(typeof(string));
            _interceptor2 = new MockTypeInterceptor(typeof(int), typeof(double));
            _interceptor3 = new MockTypeInterceptor(typeof(string), typeof(bool));
            _interceptor4 = new MockTypeInterceptor(typeof(string), typeof(double));

            _library = new InterceptorLibrary();
            _library.AddInterceptor(_interceptor1);
            _library.AddInterceptor(_interceptor2);
            _library.AddInterceptor(_interceptor3);
            _library.AddInterceptor(_interceptor4);
        }
Ejemplo n.º 2
0
        public void If_An_Interceptor_Is_Registered_At_The_PluginGraph_It_Will_Be_Used_To_Construct_An_Instance()
        {
            var interceptor = new MockTypeInterceptor();

            interceptor.AddHandler <RedSomething>(
                something => new WrappedSomething(something));

            interceptor.AddHandler <GreenSomething>(
                something => new WrappedSomething2(something));

            registry.RegisterInterceptor(interceptor);

            assertThisIsType <BlueSomething>("Blue");
            assertThatThisIsWrappedSomething <WrappedSomething, RedSomething>("Red");
            assertThatThisIsWrappedSomething <WrappedSomething2, GreenSomething>("Green");
        }