public void FactoryReadsFromConfiguration()
        {
            // --- Arrange
            var registry = new DefaultResourceConnectionProviderRegistry();

            registry.RegisterResourceConnectionProvider(typeof(MyConnection1));
            registry.RegisterResourceConnectionProvider(typeof(MyConnection2));
            ResourceConnectionProviderRegistry.Configure(registry);

            var providers = new ResourceConnectionProviderCollection
            {
                new MyConnection1("name1", 12345),
                new MyConnection1("name2", 54321),
                new MyConnection2("name3", "345"),
                new MyConnection2("name4", "678")
            };
            var settings = new ResourceConnectionFactorySettings(providers);
            var element  = settings.WriteToXml("ResourceConnections");

            settings = new ResourceConnectionFactorySettings(element);
            var factory = new DefaultResourceConnectionFactory(settings);

            // --- Act
            var resource1 = factory.CreateResourceConnection <int>("name1");
            var resource2 = factory.CreateResourceConnection <int>("name2");
            var resource3 = factory.CreateResourceConnection <int>("name3");
            var resource4 = factory.CreateResourceConnection <int>("name4");

            // --- Assert
            resource1.ShouldEqual(12345);
            resource2.ShouldEqual(54321);
            resource3.ShouldEqual(345);
            resource4.ShouldEqual(678);
        }
        public void FactoryWorksAsExpected()
        {
            // --- Arrange
            var registry = new DefaultResourceConnectionProviderRegistry();

            registry.RegisterResourceConnectionProvider(typeof(MyConnection1));
            registry.RegisterResourceConnectionProvider(typeof(MyConnection2));

            var providers = new ResourceConnectionProviderCollection
            {
                new MyConnection1("name1", 12345),
                new MyConnection1("name2", 54321),
                new MyConnection2("name3", "345"),
                new MyConnection2("name4", "678")
            };
            var settings = new ResourceConnectionFactorySettings(providers);
            var factory  = new DefaultResourceConnectionFactory(settings);

            // --- Act
            var resource1 = factory.CreateResourceConnection <int>("name1");
            var resource2 = factory.CreateResourceConnection <int>("name2");
            var resource3 = factory.CreateResourceConnection <int>("name3");
            var resource4 = factory.CreateResourceConnection <int>("name4");

            // --- Assert
            resource1.ShouldEqual(12345);
            resource2.ShouldEqual(54321);
            resource3.ShouldEqual(345);
            resource4.ShouldEqual(678);
        }