public void SetUp() { Config = DbConfig.Default; Config.StorageSystem(ConfigDefaultValues.FileStorageSystem); Config.LoggerType(typeof(ConsoleLogger)); using (var controller = DbController.Create(Config)) { if (controller.DatabaseExists(testDbName)) { controller.DeleteDatabase(testDbName, testDbAdmin, testDbPass); } } }
/// <summary> /// Gets the type of storage for the system defined in the /// configuration given. /// </summary> /// <param name="config">The <see cref="DbConfig">database /// configuration object</see> that defines the storage system /// for which to retrieve its kind of storage.</param> /// <returns> /// Returns a <see cref="StorageType"/> defined by the storage /// system configured. /// </returns> /// <seealso cref="GetStorageType(string)"/> private static StorageType GetStorageType(IDbConfig config) { // if we don't have any configuration given let's assume it's in-memory if (config == null) return StorageType.Memory; string typeName = config.StorageSystem(); if (typeName == null) throw new InvalidOperationException("A storage system must be specified."); return GetStorageType(typeName); }
public void SetUp() { Config = DbConfig.Default; Config.StorageSystem(ConfigDefaultValues.FileStorageSystem); Config.LoggerType(typeof (ConsoleLogger)); using (var controller = DbController.Create(Config)) { if (controller.DatabaseExists(testDbName)) controller.DeleteDatabase(testDbName, testDbAdmin, testDbPass); } }