/// <summary>
 /// Creates a new instance of this class using the specified settings
 /// </summary>
 public DefaultResourceConnectionProviderRegistry(ResourceConnectionProviderSettings settings)
 {
     foreach (var provider in settings.Providers)
     {
         RegisterResourceConnectionProvider(provider);
     }
 }
 /// <summary>
 /// Sets the current resource connection provider registry object to a 
 /// <see cref="DefaultResourceConnectionProviderRegistry"/>
 /// instance with the specified settings.
 /// </summary>
 /// <param name="settings">Configuration settings to be used.</param>
 public static void Configure(ResourceConnectionProviderSettings settings)
 {
     var oldValue = Current;
     Current = new DefaultResourceConnectionProviderRegistry(settings);
     OnConfigurationChanged(
         new ConfigurationChangedEventArgs<IResourceConnectionProviderRegistry>(oldValue, Current));
 }
 /// <summary>
 /// Creates a new instance of this class using the specified settings
 /// </summary>
 public DefaultResourceConnectionProviderRegistry(ResourceConnectionProviderSettings settings)
 {
     foreach (var provider in settings.Providers)
     {
         RegisterResourceConnectionProvider(provider);
     }
 }
        public void EmptySectionConstructionWorks()
        {
            // --- Act
            var settings = new ResourceConnectionProviderSettings();

            // --- Assert
            settings.Providers.ShouldHaveCountOf(0);
        }
        /// <summary>
        /// Sets the current resource connection provider registry object to a
        /// <see cref="DefaultResourceConnectionProviderRegistry"/>
        /// instance with the specified settings.
        /// </summary>
        /// <param name="settings">Configuration settings to be used.</param>
        public static void Configure(ResourceConnectionProviderSettings settings)
        {
            var oldValue = Current;

            Current = new DefaultResourceConnectionProviderRegistry(settings);
            OnConfigurationChanged(
                new ConfigurationChangedEventArgs <IResourceConnectionProviderRegistry>(oldValue, Current));
        }
        public void ConstructorWithTypesWorks()
        {
            // --- Arrange
            var types = new List<Type>()
                {
                    typeof (int),
                    typeof (string)
                };

            // --- Act
            var settings = new ResourceConnectionProviderSettings(types);

            // --- Assert
            settings.Providers.ShouldHaveCountOf(2);
        }
        public void ConstructFromXElementWorks()
        {
            // --- Arrange
            var types = new List<Type>()
                {
                    typeof (int),
                    typeof (string)
                };
            var settings = new ResourceConnectionProviderSettings(types);
            var xml = settings.WriteToXml("provider");

            // --- Act
            settings = new ResourceConnectionProviderSettings(xml);

            // --- Assert
            settings.Providers.ShouldHaveCountOf(2);
        }