public void UseInvalidTypeForDictionaryValue()
        {
            IDictionary resourceHandlers = new Hashtable();

            resourceHandlers.Add("httpsss", new Hashtable());

            ResourceHandlerConfigurer resourceHandlerConfiguer = new ResourceHandlerConfigurer();

            resourceHandlerConfiguer.ResourceHandlers = resourceHandlers;

            Assert.Throws <ObjectInitializationException>(() => resourceHandlerConfiguer.PostProcessObjectFactory((IConfigurableListableObjectFactory)mocks.DynamicMock(typeof(IConfigurableListableObjectFactory))));
        }
        public void UseNonResolvableTypeForDictionaryValue()
        {
            IDictionary resourceHandlers = new Hashtable();

            resourceHandlers.Add("httpsss", "Oragon.Spring.Core.IO.UrrrrlResource, Oragon.Spring.Core");

            ResourceHandlerConfigurer resourceHandlerConfiguer = new ResourceHandlerConfigurer();

            resourceHandlerConfiguer.ResourceHandlers = resourceHandlers;


            Assert.Throws <ObjectInitializationException>(() => resourceHandlerConfiguer.PostProcessObjectFactory((IConfigurableListableObjectFactory)mocks.DynamicMock(typeof(IConfigurableListableObjectFactory))));
        }
        public void Serialization()
        {
            IDictionary resourceHandlers = new Hashtable();

            resourceHandlers.Add("httpsss", typeof(UrlResource));

            ResourceHandlerConfigurer resourceHandlerConfiguer = new ResourceHandlerConfigurer();

            resourceHandlerConfiguer.ResourceHandlers = resourceHandlers;


            resourceHandlerConfiguer.Order = 1;

            SerializationTestUtils.SerializeAndDeserialize(resourceHandlerConfiguer);
        }
        private void CreateConfigurerAndTestNewProtcol(IDictionary resourceHandlers)
        {
            ResourceHandlerConfigurer resourceHandlerConfiguer = new ResourceHandlerConfigurer();

            resourceHandlerConfiguer.ResourceHandlers = resourceHandlers;

            resourceHandlerConfiguer.Order = 1;


            resourceHandlerConfiguer.PostProcessObjectFactory((IConfigurableListableObjectFactory)mocks.DynamicMock(typeof(IConfigurableListableObjectFactory)));

            //todo investigate mocking the typeregistry, for now ask the actual one for information.
            Assert.IsTrue(ResourceHandlerRegistry.IsHandlerRegistered("httpsss"),
                          "ResourceHandlerConfigurer did not register a protocol handler with the ResourceHandlerRegistry");

            Assert.IsTrue(ResourceHandlerRegistry.IsHandlerRegistered("httpsss"), "Custom IResource not registered.");
            Assert.AreEqual(1, resourceHandlerConfiguer.Order);
        }