public void UseNonResolvableTypeForDictionaryValue()
        {
            IDictionary typeAliases = new Hashtable();

            typeAliases.Add("LinkedList", "Oragon.Spring.Collections.LinkkkedList");

            TypeAliasConfigurer typeAliasConfigurer = new TypeAliasConfigurer();

            typeAliasConfigurer.TypeAliases = typeAliases;

            Assert.Throws <ObjectInitializationException>(() => typeAliasConfigurer.PostProcessObjectFactory(factory));
        }
        public void UseInvalidTypeForDictionaryValue()
        {
            IDictionary typeAliases = new Hashtable();

            typeAliases.Add("LinkedList", new LinkedList());

            TypeAliasConfigurer typeAliasConfigurer = new TypeAliasConfigurer();

            typeAliasConfigurer.TypeAliases = typeAliases;

            Assert.Throws <ObjectInitializationException>(() => typeAliasConfigurer.PostProcessObjectFactory(factory));
        }
        public void Serialization()
        {
            IDictionary typeAliases = new Hashtable();

            typeAliases.Add("LinkedList", typeof(LinkedList));

            TypeAliasConfigurer typeAliasConfigurer = new TypeAliasConfigurer();

            typeAliasConfigurer.TypeAliases = typeAliases;

            typeAliasConfigurer.Order = 1;

            SerializationTestUtils.SerializeAndDeserialize(typeAliasConfigurer);
        }
        private void CreateConfigurerAndTestLinkedList(IDictionary typeAliases)
        {
            TypeAliasConfigurer typeAliasConfigurer = new TypeAliasConfigurer();

            typeAliasConfigurer.TypeAliases = typeAliases;

            typeAliasConfigurer.Order = 1;


            typeAliasConfigurer.PostProcessObjectFactory(factory);

            //todo investigate mocking the typeregistry, for now ask the actual one for information.
            Assert.IsTrue(TypeRegistry.ContainsAlias("LinkedList"),
                          "TypeAliasConfigurer did not register a type alias with the TypeRegistry");

            Type linkedListType = TypeRegistry.ResolveType("LinkedList");

            Assert.IsTrue(linkedListType.Equals(typeof(LinkedList)), "Incorrect type resolved.");
            Assert.AreEqual(1, typeAliasConfigurer.Order);
        }