Commit 78e7b71

unknown <mkhan@.arcresources.ca>
2009-10-20 13:59:53
dropped more 'I's
1 parent 37dc043
product/Gorilla.Commons.Infrastructure.ThirdParty/Autofac/AutofacDependencyRegistryBuilder.cs
@@ -3,16 +3,14 @@ using Autofac;
 using Autofac.Builder;
 using Autofac.Modules;
 using AutofacContrib.DynamicProxy2;
-using Gorilla.Commons.Infrastructure;
 using Gorilla.Commons.Infrastructure.Autofac;
-using Gorilla.Commons.Infrastructure.Castle.DynamicProxy;
 using Gorilla.Commons.Infrastructure.Container;
 using gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy;
 using gorilla.commons.utility;
 
 namespace gorilla.commons.infrastructure.thirdparty.Autofac
 {
-    public class AutofacDependencyRegistryBuilder : IDependencyRegistration
+    public class AutofacDependencyRegistryBuilder : DependencyRegistration
     {
         readonly ContainerBuilder builder;
         readonly Func<IContainer> container;
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/Interceptors/CastleDynamicMethodCallTracker.cs
@@ -0,0 +1,41 @@
+using System.Collections.Generic;
+using Castle.Core.Interceptor;
+using gorilla.commons.utility;
+
+namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy.Interceptors
+{
+    public class CastleDynamicMethodCallTracker<TypeToProxy> : MethodCallTracker<TypeToProxy>
+    {
+        readonly IList<string> the_name_of_each_method_to_intercept;
+
+        public CastleDynamicMethodCallTracker() : this(new List<string>())
+        {
+        }
+
+        public CastleDynamicMethodCallTracker(IList<string> the_name_of_each_method_to_intercept)
+        {
+            this.the_name_of_each_method_to_intercept = the_name_of_each_method_to_intercept;
+        }
+
+        public TypeToProxy target { get; set; }
+
+        public void Intercept(IInvocation invocation)
+        {
+            set_return_value_for(invocation);
+            if (the_name_of_each_method_to_intercept.Contains(invocation.Method.Name)) return;
+            the_name_of_each_method_to_intercept.Add(invocation.Method.Name);
+        }
+
+        public IEnumerable<string> methods_to_intercept()
+        {
+            return the_name_of_each_method_to_intercept;
+        }
+
+        static void set_return_value_for(IInvocation invocation)
+        {
+            var return_type = invocation.Method.ReturnType;
+            if (return_type == typeof (void)) return;
+            invocation.ReturnValue = return_type.default_value();
+        }
+    }
+}
\ No newline at end of file
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/Interceptors/MethodCallTracker.cs
@@ -1,41 +1,11 @@
 using System.Collections.Generic;
 using Castle.Core.Interceptor;
-using gorilla.commons.utility;
 
 namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy.Interceptors
 {
-    public class MethodCallTracker<TypeToProxy> : IMethodCallTracker<TypeToProxy>
+    public interface MethodCallTracker<TypeToProxy> : IInterceptor
     {
-        readonly IList<string> the_name_of_each_method_to_intercept;
-
-        public MethodCallTracker() : this(new List<string>())
-        {
-        }
-
-        public MethodCallTracker(IList<string> the_name_of_each_method_to_intercept)
-        {
-            this.the_name_of_each_method_to_intercept = the_name_of_each_method_to_intercept;
-        }
-
-        public TypeToProxy target { get; set; }
-
-        public void Intercept(IInvocation invocation)
-        {
-            set_return_value_for(invocation);
-            if (the_name_of_each_method_to_intercept.Contains(invocation.Method.Name)) return;
-            the_name_of_each_method_to_intercept.Add(invocation.Method.Name);
-        }
-
-        public IEnumerable<string> methods_to_intercept()
-        {
-            return the_name_of_each_method_to_intercept;
-        }
-
-        static void set_return_value_for(IInvocation invocation)
-        {
-            var return_type = invocation.Method.ReturnType;
-            if (return_type == typeof (void)) return;
-            invocation.ReturnValue = return_type.default_value();
-        }
+        TypeToProxy target { get; }
+        IEnumerable<string> methods_to_intercept();
     }
 }
\ No newline at end of file
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/Interceptors/MethodCallTrackerSpecs.cs
@@ -6,17 +6,17 @@ using Gorilla.Commons.Testing;
 
 namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy.Interceptors
 {
-    [Concern(typeof (MethodCallTracker<>))]
+    [Concern(typeof (CastleDynamicMethodCallTracker<>))]
     public class behaves_like_method_call_tracker :
-        concerns_for<IMethodCallTracker<IAnInterface>, MethodCallTracker<IAnInterface>>
+        concerns_for<MethodCallTracker<IAnInterface>, CastleDynamicMethodCallTracker<IAnInterface>>
     {
-        public override IMethodCallTracker<IAnInterface> create_sut()
+        public override MethodCallTracker<IAnInterface> create_sut()
         {
-            return new MethodCallTracker<IAnInterface>();
+            return new CastleDynamicMethodCallTracker<IAnInterface>();
         }
     }
 
-    [Concern(typeof (MethodCallTracker<>))]
+    [Concern(typeof (CastleDynamicMethodCallTracker<>))]
     public class when_tracking_the_calls_to_intercept_on_a_type : behaves_like_method_call_tracker
     {
         static IInvocation invocation;
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/IInterceptorConstraint.cs → product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/CastleDynamicInterceptorConstraint.cs
@@ -1,22 +1,16 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Reflection;
-using Gorilla.Commons.Infrastructure.Castle.DynamicProxy;
 using gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy.Interceptors;
 
 namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
 {
-    public interface IInterceptorConstraint<TypeToPutConstraintOn> : ConstraintSelector<TypeToPutConstraintOn>
+    public class CastleDynamicInterceptorConstraint<TypeToPutConstraintOn> : InterceptorConstraint<TypeToPutConstraintOn>
     {
-        IEnumerable<string> methods_to_intercept();
-    }
-
-    public class InterceptorConstraint<TypeToPutConstraintOn> : IInterceptorConstraint<TypeToPutConstraintOn>
-    {
-        readonly IMethodCallTracker<TypeToPutConstraintOn> call_tracker;
+        readonly MethodCallTracker<TypeToPutConstraintOn> call_tracker;
         bool intercept_all_calls;
 
-        public InterceptorConstraint(IMethodCallTracker<TypeToPutConstraintOn> call_tracker)
+        public CastleDynamicInterceptorConstraint(MethodCallTracker<TypeToPutConstraintOn> call_tracker)
         {
             this.call_tracker = call_tracker;
         }
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/IMethodCallTrackerFactory.cs → product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/CastleDynamicMethodCallTrackerFactory.cs
@@ -3,27 +3,22 @@ using gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy.Interceptors
 
 namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
 {
-    public interface IMethodCallTrackerFactory
-    {
-        IMethodCallTracker<TypeToProxy> create_for<TypeToProxy>();
-    }
-
-    public class MethodCallTrackerFactory : IMethodCallTrackerFactory
+    public class CastleDynamicMethodCallTrackerFactory : MethodCallTrackerFactory
     {
         private readonly ProxyGenerator generator;
 
-        public MethodCallTrackerFactory() : this(new ProxyGenerator())
+        public CastleDynamicMethodCallTrackerFactory() : this(new ProxyGenerator())
         {
         }
 
-        public MethodCallTrackerFactory(ProxyGenerator generator)
+        public CastleDynamicMethodCallTrackerFactory(ProxyGenerator generator)
         {
             this.generator = generator;
         }
 
-        public IMethodCallTracker<TypeToProxy> create_for<TypeToProxy>()
+        public MethodCallTracker<TypeToProxy> create_for<TypeToProxy>()
         {
-            var call_tracker_interceptor = new MethodCallTracker<TypeToProxy>();
+            var call_tracker_interceptor = new CastleDynamicMethodCallTracker<TypeToProxy>();
             var target = generator.CreateInterfaceProxyWithoutTarget<TypeToProxy>(call_tracker_interceptor);
             call_tracker_interceptor.target = target;
             return call_tracker_interceptor;
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/CastleDynamicProxyBuilder.cs
@@ -2,14 +2,13 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using Castle.Core.Interceptor;
-using Gorilla.Commons.Infrastructure.Castle.DynamicProxy;
 using Gorilla.Commons.Infrastructure.Castle.DynamicProxy.Interceptors;
 
 namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
 {
     public class CastleDynamicProxyBuilder<TypeToProxy> : ProxyBuilder<TypeToProxy>
     {
-        readonly IDictionary<IInterceptor, IInterceptorConstraint<TypeToProxy>> constraints;
+        readonly IDictionary<IInterceptor, InterceptorConstraint<TypeToProxy>> constraints;
         readonly ProxyFactory proxy_factory;
         readonly IInterceptorConstraintFactory constraint_factory;
 
@@ -21,7 +20,7 @@ namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
         {
             this.proxy_factory = proxy_factory;
             this.constraint_factory = constraint_factory;
-            constraints = new Dictionary<IInterceptor, IInterceptorConstraint<TypeToProxy>>();
+            constraints = new Dictionary<IInterceptor, InterceptorConstraint<TypeToProxy>>();
         }
 
         public ConstraintSelector<TypeToProxy> add_interceptor<Interceptor>(Interceptor interceptor)
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/ConstraintSelector.cs
@@ -1,4 +1,4 @@
-namespace Gorilla.Commons.Infrastructure.Castle.DynamicProxy
+namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
 {
     public interface ConstraintSelector<TypeToPutConstraintOn>
     {
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/IInterceptorConstraintFactory.cs
@@ -2,25 +2,25 @@ namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
 {
     public interface IInterceptorConstraintFactory
     {
-        IInterceptorConstraint<Type> CreateFor<Type>();
+        InterceptorConstraint<Type> CreateFor<Type>();
     }
 
     public class InterceptorConstraintFactory : IInterceptorConstraintFactory
     {
-        readonly IMethodCallTrackerFactory factory;
+        readonly MethodCallTrackerFactory factory;
 
-        public InterceptorConstraintFactory() : this(new MethodCallTrackerFactory())
+        public InterceptorConstraintFactory() : this(new CastleDynamicMethodCallTrackerFactory())
         {
         }
 
-        public InterceptorConstraintFactory(IMethodCallTrackerFactory factory)
+        public InterceptorConstraintFactory(MethodCallTrackerFactory factory)
         {
             this.factory = factory;
         }
 
-        public IInterceptorConstraint<Type> CreateFor<Type>()
+        public InterceptorConstraint<Type> CreateFor<Type>()
         {
-            return new InterceptorConstraint<Type>(factory.create_for<Type>());
+            return new CastleDynamicInterceptorConstraint<Type>(factory.create_for<Type>());
         }
     }
 }
\ No newline at end of file
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/Interceptors/IMethodCallTracker.cs → product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/InterceptorConstraint.cs
@@ -1,11 +1,9 @@
 using System.Collections.Generic;
-using Castle.Core.Interceptor;
 
-namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy.Interceptors
+namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
 {
-    public interface IMethodCallTracker<TypeToProxy> : IInterceptor
+    public interface InterceptorConstraint<TypeToPutConstraintOn> : ConstraintSelector<TypeToPutConstraintOn>
     {
-        TypeToProxy target { get; }
         IEnumerable<string> methods_to_intercept();
     }
 }
\ No newline at end of file
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/InterceptorConstraintFactorySpecs.cs
@@ -7,21 +7,21 @@ namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
     public abstract class behaves_like_constraint_factory :
         concerns_for<IInterceptorConstraintFactory, InterceptorConstraintFactory>
     {
-        context c = () => { method_call_tracker_factory = the_dependency<IMethodCallTrackerFactory>(); };
+        context c = () => { method_call_tracker_factory = the_dependency<MethodCallTrackerFactory>(); };
 
-        protected static IMethodCallTrackerFactory method_call_tracker_factory;
+        protected static MethodCallTrackerFactory method_call_tracker_factory;
     }
 
     [Concern(typeof (InterceptorConstraintFactory))]
     public class when_creating_a_constraint_for_a_type_to_intercept_on : behaves_like_constraint_factory
     {
-        static IInterceptorConstraint<string> result;
+        static InterceptorConstraint<string> result;
 
         it should_create_a_method_call_tracker_for_the_type_to_place_a_constraint_on =
             () => method_call_tracker_factory.was_told_to(f => f.create_for<string>());
 
         it should_return_an_instance_of_an_interceptor_constraint =
-            () => result.should_be_an_instance_of<InterceptorConstraint<string>>();
+            () => result.should_be_an_instance_of<CastleDynamicInterceptorConstraint<string>>();
 
         because b = () => { result = sut.CreateFor<string>(); };
     }
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/InterceptorConstraintSpecs.cs
@@ -5,15 +5,15 @@ using Gorilla.Commons.Testing;
 
 namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
 {
-    [Concern(typeof (InterceptorConstraint<>))]
-    public abstract class behaves_like_constraint : concerns_for<IInterceptorConstraint<string>, InterceptorConstraint<string>>
+    [Concern(typeof (CastleDynamicInterceptorConstraint<>))]
+    public abstract class behaves_like_constraint : concerns_for<InterceptorConstraint<string>, CastleDynamicInterceptorConstraint<string>>
     {
-        context c = () => { method_call_tracker = the_dependency<IMethodCallTracker<string>>(); };
+        context c = () => { method_call_tracker = the_dependency<MethodCallTracker<string>>(); };
 
-        protected static IMethodCallTracker<string> method_call_tracker;
+        protected static MethodCallTracker<string> method_call_tracker;
     }
 
-    [Concern(typeof (InterceptorConstraint<>))]
+    [Concern(typeof (CastleDynamicInterceptorConstraint<>))]
     public class when_asking_for_all_the_methods_to_intercept : behaves_like_constraint
     {
         static IEnumerable<string> result;
@@ -33,17 +33,17 @@ namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
         because b = () => { result = sut.methods_to_intercept(); };
     }
 
-    [Concern(typeof (InterceptorConstraint<int>))]
+    [Concern(typeof (CastleDynamicInterceptorConstraint<int>))]
     public class when_asking_for_the_target_of_the_interception_constrain :
-        concerns_for<IInterceptorConstraint<int>, InterceptorConstraint<int>>
+        concerns_for<InterceptorConstraint<int>, CastleDynamicInterceptorConstraint<int>>
     {
-        static IMethodCallTracker<int> method_call_tracker;
+        static MethodCallTracker<int> method_call_tracker;
         static int result;
         const int target_of_interception = 7;
 
         context c = () =>
         {
-            method_call_tracker = the_dependency<IMethodCallTracker<int>>();
+            method_call_tracker = the_dependency<MethodCallTracker<int>>();
             method_call_tracker.is_told_to(t => t.target).it_will_return(target_of_interception);
         };
 
product/Gorilla.Commons.Infrastructure.ThirdParty/Lazy.cs → product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/Lazy.cs
@@ -5,7 +5,7 @@ using Gorilla.Commons.Infrastructure.Castle.DynamicProxy;
 using Gorilla.Commons.Infrastructure.Container;
 using gorilla.commons.utility;
 
-namespace Gorilla.Commons.Infrastructure
+namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
 {
     public static class Lazy
     {
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/LazySpecs.cs
@@ -0,0 +1,200 @@
+using developwithpassion.bdd.contexts;
+using Gorilla.Commons.Infrastructure.Container;
+using Gorilla.Commons.Testing;
+
+namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
+{
+    public class LazySpecs
+    {
+        [Concern(typeof (Lazy))]
+        public abstract class behaves_like_a_lazy_loaded_object : concerns
+        {
+            context c = () =>
+            {
+                test_container = dependency<DependencyRegistry>();
+                Resolve.initialize_with(test_container);
+            };
+
+            after_each_observation a = () => Resolve.initialize_with(null);
+
+            static protected DependencyRegistry test_container;
+        }
+
+        [Concern(typeof (Lazy))]
+        public class when_calling_a_method_with_no_arguments_on_a_lazy_loaded_proxy : behaves_like_a_lazy_loaded_object
+        {
+            it should_forward_the_original_call_to_the_target = () => target.was_told_to(t => t.OneMethod());
+
+            context c = () =>
+            {
+                target = an<ITargetObject>();
+                test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target).Repeat.Once();
+            };
+
+            because b = () =>
+            {
+                var result = Lazy.load<ITargetObject>();
+                result.OneMethod();
+            };
+
+            static ITargetObject target;
+        }
+
+        [Concern(typeof (Lazy))]
+        public class when_calling_a_method_that_returns_an_argument_on_a_lazy_loaded_proxy :
+            behaves_like_a_lazy_loaded_object
+        {
+            it should_return_the_value_from_the_actual_target = () => result.should_be_equal_to(10);
+
+            context c = () =>
+            {
+                var target = an<ITargetObject>();
+
+                target.is_told_to(x => x.FirstValueReturningMethod()).it_will_return(10);
+                test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target).Repeat.Once();
+            };
+
+            because b = () =>
+            {
+                var proxy = Lazy.load<ITargetObject>();
+                result = proxy.FirstValueReturningMethod();
+            };
+
+            static int result;
+        }
+
+        [Concern(typeof (Lazy))]
+        public class when_calling_different_methods_on_an_proxied_object : behaves_like_a_lazy_loaded_object
+        {
+            it should_only_load_the_object_once =
+                () => test_container.was_told_to(x => x.get_a<ITargetObject>()).only_once();
+
+            context c = () =>
+            {
+                var target = an<ITargetObject>();
+                test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target).Repeat.Once();
+            };
+
+            because b = () =>
+            {
+                var proxy = Lazy.load<ITargetObject>();
+                proxy.SecondMethod();
+                proxy.FirstValueReturningMethod();
+            };
+        }
+
+        [Concern(typeof (Lazy))]
+        public class when_calling_a_method_that_takes_in_a_single_input_parameter_on_a_proxied_object :
+            behaves_like_a_lazy_loaded_object
+        {
+            it should_forward_the_call_to_the_original_target =
+                () => target.was_told_to(x => x.ValueReturningMethodWithAnArgument(88));
+
+            it should_return_the_correct_result = () => result.should_be_equal_to(99);
+
+            context c = () =>
+            {
+                target = an<ITargetObject>();
+
+                target.is_told_to(x => x.ValueReturningMethodWithAnArgument(88)).it_will_return(99);
+                test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target).Repeat.Once();
+            };
+
+            because b = () =>
+            {
+                var proxy = Lazy.load<ITargetObject>();
+                result = proxy.ValueReturningMethodWithAnArgument(88);
+            };
+
+            static ITargetObject target;
+            static int result;
+        }
+
+        [Concern(typeof (Lazy))]
+        public class when_accessing_the_value_of_a_property_on_a_proxied_object : behaves_like_a_lazy_loaded_object
+        {
+            it should_return_the_correct_value = () => result.should_be_equal_to("mo");
+
+            context c = () =>
+            {
+                var target = an<ITargetObject>();
+
+                target.GetterAndSetterProperty = "mo";
+                test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target).Repeat.Once();
+            };
+
+            because b = () =>
+            {
+                var proxy = Lazy.load<ITargetObject>();
+                result = proxy.GetterAndSetterProperty;
+            };
+
+            static string result;
+        }
+
+        [Concern(typeof (Lazy))]
+        public class when_setting_the_value_of_a_property_on_a_proxied_object : behaves_like_a_lazy_loaded_object
+        {
+            it should_set_the_value_on_the_original_target =
+                () => target.was_told_to(x => x.GetterAndSetterProperty = "khan");
+
+            context c = () =>
+            {
+                target = dependency<ITargetObject>();
+                test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target).Repeat.Once();
+            };
+
+            because b = () =>
+            {
+                var proxy = Lazy.load<ITargetObject>();
+                proxy.GetterAndSetterProperty = "khan";
+            };
+
+            static ITargetObject target;
+        }
+
+        [Concern(typeof (Lazy))]
+        public class when_calling_a_generic_method_on_a_proxied_object : behaves_like_a_lazy_loaded_object
+        {
+            it should_forward_the_call_to_the_target =
+                () => target.was_told_to(x => x.ValueReturningMethodWithAnArgument("blah"));
+
+            it should_return_the_correct_result = () => result.should_be_equal_to("hooray");
+
+            context c = () =>
+            {
+                target = an<IGenericInterface<string>>();
+
+                target.is_told_to(x => x.ValueReturningMethodWithAnArgument("blah")).it_will_return("hooray");
+                test_container.is_told_to(t => t.get_a<IGenericInterface<string>>()).it_will_return(target).Repeat.Once();
+            };
+
+            because b = () =>
+            {
+                var proxy = Lazy.load<IGenericInterface<string>>();
+                result = proxy.ValueReturningMethodWithAnArgument("blah");
+            };
+
+            static IGenericInterface<string> target;
+            static string result;
+        }
+
+        public interface IGenericInterface<T>
+        {
+            T GetterAndSetterProperty { get; set; }
+            void OneMethod();
+            void SecondMethod();
+            T FirstValueReturningMethod();
+            T ValueReturningMethodWithAnArgument(T item);
+        }
+
+        public interface ITargetObject
+        {
+            string GetterAndSetterProperty { get; set; }
+            void OneMethod();
+            void SecondMethod();
+            int FirstValueReturningMethod();
+            int ValueReturningMethodWithAnArgument(int number);
+        }
+    }
+}
\ No newline at end of file
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/MethodCallTrackerFactory.cs
@@ -0,0 +1,9 @@
+using gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy.Interceptors;
+
+namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
+{
+    public interface MethodCallTrackerFactory
+    {
+        MethodCallTracker<TypeToProxy> create_for<TypeToProxy>();
+    }
+}
\ No newline at end of file
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/ProxyBuilder.cs
@@ -1,7 +1,7 @@
 using System;
 using Castle.Core.Interceptor;
 
-namespace Gorilla.Commons.Infrastructure.Castle.DynamicProxy
+namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
 {
     public interface ProxyBuilder<TypeToProxy>
     {
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/DynamicProxy/ProxyBuilderSpecs.cs
@@ -4,7 +4,6 @@ using System.Linq;
 using System.Reflection;
 using Castle.Core.Interceptor;
 using developwithpassion.bdd.contexts;
-using Gorilla.Commons.Infrastructure.Castle.DynamicProxy;
 using Gorilla.Commons.Testing;
 
 namespace gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/Windsor/Configuration/ApplyLoggingInterceptor.cs
@@ -2,9 +2,9 @@ using Castle.Core;
 using Castle.MicroKernel.Registration;
 using Gorilla.Commons.Infrastructure.Logging;
 
-namespace Gorilla.Commons.Infrastructure.Castle.Windsor.Configuration
+namespace gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration
 {
-    public class ApplyLoggingInterceptor : IRegistrationConfiguration
+    public class ApplyLoggingInterceptor : RegistrationConfiguration
     {
         public void configure(ComponentRegistration registration)
         {
@@ -12,7 +12,7 @@ namespace Gorilla.Commons.Infrastructure.Castle.Windsor.Configuration
             if (typeof (Loggable).IsAssignableFrom(implementation))
             {
                 registration
-                    .Interceptors(new InterceptorReference(typeof (ILoggingInterceptor)))
+                    .Interceptors(new InterceptorReference(typeof (LoggingInterceptor)))
                     .First
                     .If((k, m) => true);
             }
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/Windsor/Configuration/ComponentRegistrationConfiguration.cs
@@ -1,13 +1,9 @@
 using Castle.MicroKernel.Registration;
 using gorilla.commons.utility;
 
-namespace Gorilla.Commons.Infrastructure.Castle.Windsor.Configuration
+namespace gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration
 {
-    public interface IRegistrationConfiguration : Configuration<ComponentRegistration>
-    {
-    }
-
-    public class ComponentRegistrationConfiguration : IRegistrationConfiguration
+    public class ComponentRegistrationConfiguration : RegistrationConfiguration
     {
         public void configure(ComponentRegistration registration)
         {
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/Windsor/Configuration/ConfigureComponentLifestyle.cs
@@ -1,9 +1,9 @@
 using Castle.Core;
 using Castle.MicroKernel.Registration;
 
-namespace Gorilla.Commons.Infrastructure.Castle.Windsor.Configuration
+namespace gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration
 {
-    public class ConfigureComponentLifestyle : IRegistrationConfiguration
+    public class ConfigureComponentLifestyle : RegistrationConfiguration
     {
         public void configure(ComponentRegistration registration)
         {
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/Windsor/Configuration/LogComponent.cs
@@ -1,8 +1,8 @@
 using Castle.MicroKernel.Registration;
 
-namespace Gorilla.Commons.Infrastructure.Castle.Windsor.Configuration
+namespace gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration
 {
-    public class LogComponent : IRegistrationConfiguration
+    public class LogComponent : RegistrationConfiguration
     {
         public void configure(ComponentRegistration registration)
         {
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/Windsor/Configuration/LogEverythingInterceptor.cs
@@ -0,0 +1,18 @@
+using System.Diagnostics;
+using Castle.Core.Interceptor;
+using Gorilla.Commons.Infrastructure.Logging;
+
+namespace gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration
+{
+    public class LogEverythingInterceptor : LoggingInterceptor
+    {
+        public void Intercept(IInvocation invocation)
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+            invocation.Proceed();
+            stopwatch.Stop();
+            this.log().debug("{0}.{1} took {2}", invocation.TargetType.Name, invocation.Method.Name, stopwatch.Elapsed);
+        }
+    }
+}
\ No newline at end of file
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/Windsor/Configuration/LoggingInterceptor.cs
@@ -1,22 +1,8 @@
-using System.Diagnostics;
 using Castle.Core.Interceptor;
-using Gorilla.Commons.Infrastructure.Logging;
 
-namespace Gorilla.Commons.Infrastructure.Castle.Windsor.Configuration
+namespace gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration
 {
-    public interface ILoggingInterceptor : IInterceptor
+    public interface LoggingInterceptor : IInterceptor
     {
     }
-
-    public class LoggingInterceptor : ILoggingInterceptor
-    {
-        public void Intercept(IInvocation invocation)
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-            invocation.Proceed();
-            stopwatch.Stop();
-            this.log().debug("{0}.{1} took {2}", invocation.TargetType.Name, invocation.Method.Name, stopwatch.Elapsed);
-        }
-    }
 }
\ No newline at end of file
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/Windsor/Configuration/RegisterComponentContract.cs
@@ -1,8 +1,8 @@
 using Castle.MicroKernel.Registration;
 
-namespace Gorilla.Commons.Infrastructure.Castle.Windsor.Configuration
+namespace gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration
 {
-    public class RegisterComponentContract : IRegistrationConfiguration
+    public class RegisterComponentContract : RegistrationConfiguration
     {
         public void configure(ComponentRegistration registration)
         {
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/Windsor/Configuration/RegistrationConfiguration.cs
@@ -0,0 +1,9 @@
+using Castle.MicroKernel.Registration;
+using gorilla.commons.utility;
+
+namespace gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration
+{
+    public interface RegistrationConfiguration : Configuration<ComponentRegistration>
+    {
+    }
+}
\ No newline at end of file
product/Gorilla.Commons.Infrastructure.ThirdParty/Castle/Windsor/WindsorDependencyRegistry.cs
@@ -2,15 +2,13 @@ using System;
 using System.Collections.Generic;
 using Castle.Core;
 using Castle.Windsor;
-using Gorilla.Commons.Infrastructure;
-using Gorilla.Commons.Infrastructure.Castle.DynamicProxy;
 using Gorilla.Commons.Infrastructure.Container;
 using gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy;
 using gorilla.commons.utility;
 
 namespace gorilla.commons.infrastructure.thirdparty.Castle.Windsor
 {
-    public class WindsorDependencyRegistry : IDependencyRegistration, DependencyRegistry
+    public class WindsorDependencyRegistry : DependencyRegistration, DependencyRegistry
     {
         readonly IWindsorContainer underlying_container;
 
product/Gorilla.Commons.Infrastructure.ThirdParty/Log4Net/Log4NetLogFactory.cs
@@ -5,7 +5,7 @@ using Gorilla.Commons.Infrastructure.Reflection;
 using log4net;
 using log4net.Config;
 
-namespace Gorilla.Commons.Infrastructure.Log4Net
+namespace gorilla.commons.infrastructure.thirdparty.Log4Net
 {
     public class Log4NetLogFactory : LogFactory
     {
product/Gorilla.Commons.Infrastructure.ThirdParty/Log4Net/Log4NetLogger.cs
@@ -2,7 +2,7 @@ using System;
 using Gorilla.Commons.Infrastructure.Logging;
 using log4net;
 
-namespace Gorilla.Commons.Infrastructure.Log4Net
+namespace gorilla.commons.infrastructure.thirdparty.Log4Net
 {
     public class Log4NetLogger : Logger
     {
product/Gorilla.Commons.Infrastructure.ThirdParty/IDependencyRegistration.cs → product/Gorilla.Commons.Infrastructure.ThirdParty/DependencyRegistration.cs
@@ -1,11 +1,11 @@
 using System;
-using Gorilla.Commons.Infrastructure.Castle.DynamicProxy;
 using Gorilla.Commons.Infrastructure.Container;
+using gorilla.commons.infrastructure.thirdparty.Castle.DynamicProxy;
 using gorilla.commons.utility;
 
-namespace Gorilla.Commons.Infrastructure
+namespace gorilla.commons.infrastructure.thirdparty
 {
-    public interface IDependencyRegistration : Builder<DependencyRegistry>
+    public interface DependencyRegistration : Builder<DependencyRegistry>
     {
         void singleton<Contract, Implementation>() where Implementation : Contract;
         void singleton<Contract>(Func<Contract> instance_of_the_contract);
product/Gorilla.Commons.Infrastructure.ThirdParty/infrastructure.thirdparty.csproj
@@ -92,26 +92,30 @@
     <Compile Include="Autofac\AutofacDependencyRegistry.cs" />
     <Compile Include="Autofac\AutofacDependencyRegistryBuilder.cs" />
     <Compile Include="Autofac\AutofacSpecs.cs" />
+    <Compile Include="Castle\DynamicProxy\CastleDynamicInterceptorConstraint.cs" />
     <Compile Include="Castle\DynamicProxy\Interceptors\SynchronizedInterceptor.cs" />
+    <Compile Include="Castle\DynamicProxy\CastleDynamicMethodCallTrackerFactory.cs" />
+    <Compile Include="Castle\Windsor\Configuration\RegistrationConfiguration.cs" />
+    <Compile Include="Castle\Windsor\Configuration\LoggingInterceptor.cs" />
     <Compile Include="Castle\Windsor\WindsorExtensions.cs" />
-    <Compile Include="IDependencyRegistration.cs" />
+    <Compile Include="DependencyRegistration.cs" />
     <Compile Include="Log4Net\Log4NetLogFactory.cs" />
     <Compile Include="Log4Net\Log4NetLogger.cs" />
     <Compile Include="Castle\DynamicProxy\ConstraintSelector.cs" />
-    <Compile Include="Castle\DynamicProxy\IInterceptorConstraint.cs" />
+    <Compile Include="Castle\DynamicProxy\InterceptorConstraint.cs" />
     <Compile Include="Castle\DynamicProxy\IInterceptorConstraintFactory.cs" />
-    <Compile Include="Castle\DynamicProxy\IMethodCallTrackerFactory.cs" />
+    <Compile Include="Castle\DynamicProxy\MethodCallTrackerFactory.cs" />
     <Compile Include="Castle\DynamicProxy\InterceptorConstraintFactorySpecs.cs" />
     <Compile Include="Castle\DynamicProxy\InterceptorConstraintSpecs.cs" />
-    <Compile Include="Castle\DynamicProxy\Interceptors\IMethodCallTracker.cs" />
     <Compile Include="Castle\DynamicProxy\Interceptors\MethodCallTracker.cs" />
+    <Compile Include="Castle\DynamicProxy\Interceptors\CastleDynamicMethodCallTracker.cs" />
     <Compile Include="Castle\DynamicProxy\Interceptors\MethodCallTrackerSpecs.cs" />
     <Compile Include="Castle\DynamicProxy\Interceptors\SelectiveInterceptor.cs" />
     <Compile Include="Castle\DynamicProxy\ProxyBuilder.cs" />
     <Compile Include="Castle\DynamicProxy\ProxyFactory.cs" />
-    <Compile Include="Lazy.cs" />
+    <Compile Include="Castle\DynamicProxy\Lazy.cs" />
     <Compile Include="Castle\DynamicProxy\LazyLoadedInterceptor.cs" />
-    <Compile Include="LazySpecs.cs" />
+    <Compile Include="Castle\DynamicProxy\LazySpecs.cs" />
     <Compile Include="Castle\DynamicProxy\CastleDynamicProxyBuilder.cs" />
     <Compile Include="Castle\DynamicProxy\ProxyBuilderSpecs.cs" />
     <Compile Include="Castle\DynamicProxy\CastleDynamicProxyFactory.cs" />
@@ -121,7 +125,7 @@
     <Compile Include="Castle\Windsor\Configuration\ConfigureComponentLifestyle.cs" />
     <Compile Include="Castle\Windsor\Configuration\ComponentExclusionSpecification.cs" />
     <Compile Include="Castle\Windsor\Configuration\LogComponent.cs" />
-    <Compile Include="Castle\Windsor\Configuration\LoggingInterceptor.cs" />
+    <Compile Include="Castle\Windsor\Configuration\LogEverythingInterceptor.cs" />
     <Compile Include="Castle\Windsor\Configuration\RegisterComponentContract.cs" />
     <Compile Include="Castle\Windsor\WindsorContainerFactory.cs" />
     <Compile Include="Castle\Windsor\WindsorDependencyRegistry.cs" />
product/Gorilla.Commons.Infrastructure.ThirdParty/LazySpecs.cs
@@ -1,197 +0,0 @@
-using developwithpassion.bdd.contexts;
-using Gorilla.Commons.Infrastructure.Container;
-using Gorilla.Commons.Testing;
-
-namespace Gorilla.Commons.Infrastructure
-{
-    [Concern(typeof (Lazy))]
-    public abstract class behaves_like_a_lazy_loaded_object : concerns
-    {
-        context c = () =>
-                        {
-                            test_container = dependency<DependencyRegistry>();
-                            Resolve.initialize_with(test_container);
-                        };
-
-        after_each_observation a = () => Resolve.initialize_with(null);
-
-        protected static DependencyRegistry test_container;
-    }
-
-    [Concern(typeof (Lazy))]
-    public class when_calling_a_method_with_no_arguments_on_a_lazy_loaded_proxy : behaves_like_a_lazy_loaded_object
-    {
-        it should_forward_the_original_call_to_the_target = () => target.was_told_to<ITargetObject>(t => t.OneMethod());
-
-        context c = () =>
-                        {
-                            target = an<ITargetObject>();
-                            test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target).Repeat.Once();
-                        };
-
-        because b = () =>
-                        {
-                            var result = Lazy.load<ITargetObject>();
-                            result.OneMethod();
-                        };
-
-        static ITargetObject target;
-    }
-
-    [Concern(typeof (Lazy))]
-    public class when_calling_a_method_that_returns_an_argument_on_a_lazy_loaded_proxy :
-        behaves_like_a_lazy_loaded_object
-    {
-        it should_return_the_value_from_the_actual_target = () => result.should_be_equal_to(10);
-
-        context c = () =>
-                        {
-                            var target = an<ITargetObject>();
-
-                            target.is_told_to(x => x.FirstValueReturningMethod()).it_will_return(10);
-                            test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target) .Repeat.Once();
-                        };
-
-        because b = () =>
-                        {
-                            var proxy = Lazy.load<ITargetObject>();
-                            result = proxy.FirstValueReturningMethod();
-                        };
-
-        static int result;
-    }
-
-    [Concern(typeof (Lazy))]
-    public class when_calling_different_methods_on_an_proxied_object : behaves_like_a_lazy_loaded_object
-    {
-        it should_only_load_the_object_once =
-            () => test_container.was_told_to(x => x.get_a<ITargetObject>()).only_once();
-
-        context c = () =>
-                        {
-                            var target = an<ITargetObject>();
-                            test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target).Repeat.Once();
-                        };
-
-        because b = () =>
-                        {
-                            var proxy = Lazy.load<ITargetObject>();
-                            proxy.SecondMethod();
-                            proxy.FirstValueReturningMethod();
-                        };
-    }
-
-    [Concern(typeof (Lazy))]
-    public class when_calling_a_method_that_takes_in_a_single_input_parameter_on_a_proxied_object :
-        behaves_like_a_lazy_loaded_object
-    {
-        it should_forward_the_call_to_the_original_target =
-            () => target.was_told_to(x => x.ValueReturningMethodWithAnArgument(88));
-
-        it should_return_the_correct_result = () => result.should_be_equal_to(99);
-
-        context c = () =>
-                        {
-                            target = an<ITargetObject>();
-
-                            target.is_told_to(x => x.ValueReturningMethodWithAnArgument(88)).it_will_return(99);
-                            test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target).Repeat.Once();
-                        };
-
-        because b = () =>
-                        {
-                            var proxy = Lazy.load<ITargetObject>();
-                            result = proxy.ValueReturningMethodWithAnArgument(88);
-                        };
-
-        static ITargetObject target;
-        static int result;
-    }
-
-    [Concern(typeof (Lazy))]
-    public class when_accessing_the_value_of_a_property_on_a_proxied_object : behaves_like_a_lazy_loaded_object
-    {
-        it should_return_the_correct_value = () => result.should_be_equal_to("mo");
-
-        context c = () =>
-                        {
-                            var target = an<ITargetObject>();
-
-                            target.GetterAndSetterProperty = "mo";
-                            test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target).Repeat.Once();
-                        };
-
-        because b = () =>
-                        {
-                            var proxy = Lazy.load<ITargetObject>();
-                            result = proxy.GetterAndSetterProperty;
-                        };
-
-        static string result;
-    }
-
-    [Concern(typeof (Lazy))]
-    public class when_setting_the_value_of_a_property_on_a_proxied_object : behaves_like_a_lazy_loaded_object
-    {
-        it should_set_the_value_on_the_original_target =
-            () => target.was_told_to(x => x.GetterAndSetterProperty = "khan");
-
-        context c = () =>
-                        {
-                            target = dependency<ITargetObject>();
-                            test_container.is_told_to(t => t.get_a<ITargetObject>()).it_will_return(target) .Repeat.Once();
-                        };
-
-        because b = () =>
-                        {
-                            var proxy = Lazy.load<ITargetObject>();
-                            proxy.GetterAndSetterProperty = "khan";
-                        };
-
-        static ITargetObject target;
-    }
-
-    [Concern(typeof (Lazy))]
-    public class when_calling_a_generic_method_on_a_proxied_object : behaves_like_a_lazy_loaded_object
-    {
-        it should_forward_the_call_to_the_target =
-            () => target.was_told_to(x => x.ValueReturningMethodWithAnArgument("blah"));
-
-        it should_return_the_correct_result = () => result.should_be_equal_to("hooray");
-
-        context c = () =>
-                        {
-                            target = an<IGenericInterface<string>>();
-
-                            target.is_told_to(x => x.ValueReturningMethodWithAnArgument("blah")).it_will_return("hooray");
-                            test_container.is_told_to(t => t.get_a<IGenericInterface<string>>()).it_will_return(target).Repeat.Once();
-                        };
-
-        because b = () =>
-                        {
-                            var proxy = Lazy.load<IGenericInterface<string>>();
-                            result = proxy.ValueReturningMethodWithAnArgument("blah");
-                        };
-
-        static IGenericInterface<string> target;
-        static string result;
-    }
-
-    public interface IGenericInterface<T>
-    {
-        T GetterAndSetterProperty { get; set; }
-        void OneMethod();
-        void SecondMethod();
-        T FirstValueReturningMethod();
-        T ValueReturningMethodWithAnArgument(T item);
-    }
-
-    public interface ITargetObject
-    {
-        string GetterAndSetterProperty { get; set; }
-        void OneMethod();
-        void SecondMethod();
-        int FirstValueReturningMethod();
-        int ValueReturningMethodWithAnArgument(int number);
-    }
-}
\ No newline at end of file