public void CanRegisterMultipleTypeMappings() { TestableRootCompositionContainer root = new TestableRootCompositionContainer(); root.RegisterTypeMapping<IFoo, Foo>(); root.RegisterTypeMapping<IBar, Bar>(); Assert.AreEqual(typeof (Bar), root.GetMappedType<IBar>()); Assert.AreEqual(typeof (Foo), root.GetMappedType<IFoo>()); }
public void CanRegisterTypeMappingViaTypeObjects() { TestableRootCompositionContainer root = new TestableRootCompositionContainer(); root.RegisterTypeMapping(typeof (IFoo), typeof (Foo)); Type mappedType = root.GetMappedType(typeof (IFoo)); Assert.AreEqual(typeof (Foo), mappedType); }
public void CanRegisterTypeMappingOnRootContainer() { TestableRootCompositionContainer root = new TestableRootCompositionContainer(); root.RegisterTypeMapping<IFoo, Foo>(); Type mappedType = root.GetMappedType<IFoo>(); Assert.AreEqual(typeof (Foo), mappedType); }
public void RequestingTypeMappingForUnmappedTypeReturnsRequestedType() { TestableRootCompositionContainer root = new TestableRootCompositionContainer(); Type mappedType = root.GetMappedType<Foo>(); Assert.AreEqual(typeof (Foo), mappedType); }
public void ChildContainersCanOverrideParentTypeMapping() { TestableRootCompositionContainer parent = new TestableRootCompositionContainer(); CompositionContainer child = parent.Containers.AddNew<CompositionContainer>(); parent.RegisterTypeMapping<IFoo, Foo>(); child.RegisterTypeMapping<IFoo, Foo2>(); Assert.AreEqual(typeof (Foo), parent.GetMappedType<IFoo>()); Assert.AreEqual(typeof (Foo2), child.GetMappedType<IFoo>()); }