Exemplo n.º 1
0
        public void throw_exception_when_passing_wrong_qualified_name()
        {
            var container = new WindsorContainer();
            var bytecode  = new EnhancedBytecode(container);

            const string qualifiedName = "kkdlkdsa";

            new Action(() => bytecode.SetCollectionTypeFactoryClass(qualifiedName))
            .Should().Throw <TypeLoadException>();
        }
Exemplo n.º 2
0
        public void can_inject_through_type()
        {
            var  container       = new WindsorContainer();
            var  bytecode        = new EnhancedBytecode(container);
            Type collFactoryType = typeof(TestCollTypeFactory);

            bytecode.SetCollectionTypeFactoryClass(collFactoryType);

            bytecode.CollectionTypeFactory.GetType()
            .Should().Be.EqualTo(collFactoryType);
        }
Exemplo n.º 3
0
        public void can_inject_through_type_and_resolve_from_container()
        {
            var container   = new WindsorContainer();
            var bytecode    = new EnhancedBytecode(container);
            var collFactory = new TestCollTypeFactory();

            container.Register(Component.For <TestCollTypeFactory>().Instance(collFactory));

            Type collFactoryType = typeof(TestCollTypeFactory);

            bytecode.SetCollectionTypeFactoryClass(collFactoryType);

            bytecode.CollectionTypeFactory
            .Should().Be.SameInstanceAs(collFactory);
        }