private static void CreateAndAssert(string configSectionName, string expectedContainerTypeKey,
                                            string expectedStorageLocation, Type expectedImplementationType)
        {
            StorageContainerConfigurationSection storageContainerConfigurationSection =
                (StorageContainerConfigurationSection)ConfigurationManager.GetSection(configSectionName);

            Assert.AreEqual(expectedContainerTypeKey, storageContainerConfigurationSection.ContainerTypeKey);
            Assert.AreEqual(expectedStorageLocation, storageContainerConfigurationSection.StorageLocation);

            IStorageContainer storageContainer = StorageContainerFactory.Create(storageContainerConfigurationSection);

            Assert.IsInstanceOfType(storageContainer, expectedImplementationType);
        }
        /// <summary>
        ///   Creates an instance of the storage container specified in the specified configuration section.
        /// </summary>
        /// <param name = "storageContainerConfigurationSection">The storage container configuration section.</param>
        /// <returns>An <see cref = "IStorageContainer" /> implementation instance.</returns>
        /// <exception cref = "InvalidContainerTypeKeyException"> thrown when the ContainerTypeKey property of the specified <see cref = "StorageContainerConfigurationSection" />
        /// is invalid.</exception>
        public static IStorageContainer Create(StorageContainerConfigurationSection storageContainerConfigurationSection)
        {
            switch (storageContainerConfigurationSection.ContainerTypeKey)
            {
            case "CacheSwapping":
            {
                return(new CacheSwappingStorageContainer(storageContainerConfigurationSection.StorageLocation));
            }

            case "InMemory":
            {
                return(new InMemoryStorageContainer());
            }

            case "SqlServer":
            {
                return(new SqlServerStorageContainer(storageContainerConfigurationSection.StorageLocation));
            }
            }

            throw new InvalidContainerTypeKeyException(storageContainerConfigurationSection.ContainerTypeKey);
        }