예제 #1
0
        private void ProcessMappedType(BuildRule buildRule, Type buildType)
        {
            if (buildRule.mappedtype == null)
            {
                return;
            }

            Type type = Type.GetType(buildRule.mappedtype.type);
            TypeMappingPolicy policy = new TypeMappingPolicy(type, buildRule.mappedtype.name);

            builder.Policies.Set <ITypeMappingPolicy>(policy, buildType, buildRule.name);
        }
예제 #2
0
        public void CanMapTypesWithDefaultObjectBuilder()
        {
            Builder builder = new Builder();
            Locator locator = CreateLocator();

            TypeMappingPolicy policy = new TypeMappingPolicy(typeof(MockObject), null);

            builder.Policies.Set <ITypeMappingPolicy>(policy, typeof(IMockObject), null);

            IMockObject obj = builder.BuildUp <IMockObject>(locator, null, null);

            Assert.IsTrue(obj is MockObject);
        }
        public void CanMapTypesWithDefaultObjectBuilder()
        {
            WCSFBuilder builder = new WCSFBuilder();
            Locator locator = CreateLocator();

            TypeMappingPolicy policy = new TypeMappingPolicy(typeof (MockObject), null);
            builder.Policies.Set<ITypeMappingPolicy>(policy, typeof (IMockObject), null);

            IMockObject obj = builder.BuildUp<IMockObject>(locator, null, null);

            Assert.IsTrue(obj is MockObject);
        }
        public void PolicyReturnsGivenType()
        {
            TypeMappingPolicy policy = new TypeMappingPolicy(typeof(Foo), null);

            Assert.AreEqual(new DependencyResolutionLocatorKey(typeof(Foo), null), policy.Map(new DependencyResolutionLocatorKey()));
        }