public void Null_Replica_Throws() { IStorageProviderConfig from = null; var to = new Mock <IStorageProviderConfig>(); Assert.Throws <ArgumentNullException>(() => new MigrationProviderConfig(from, to.Object)); }
public void Null_Master_Throws() { var from = new Mock <IStorageProviderConfig>(); IStorageProviderConfig to = null; Assert.Throws <ArgumentNullException>(() => new MigrationProviderConfig(from.Object, to)); }
public void Null_Replica_Throws() { IStorageProviderConfig master = null; var replica = new Mock <IStorageProviderConfig>(); Assert.Throws <ArgumentNullException>(() => new ReplicatedProviderConfig(master, replica.Object)); }
public void Null_Master_Throws() { var master = new Mock <IStorageProviderConfig>(); IStorageProviderConfig replica = null; Assert.Throws <ArgumentNullException>(() => new ReplicatedProviderConfig(master.Object, replica)); }
public IFileCabinet GetCabinet(IStorageProviderConfig config) { Contract.NotNull(config, nameof(config)); Type configType = config.GetType(); return(CreateFileCabinet(config, configType)); }
public ReplicatedProviderConfig(IStorageProviderConfig master, IStorageProviderConfig replica, string delimiter = null) { Contract.NotNull(master, nameof(master)); Contract.NotNull(replica, nameof(replica)); this.Delimiter = !String.IsNullOrWhiteSpace(delimiter) ? delimiter : master.Delimiter; this.Master = master; this.Replica = replica; }
public MigrationProviderConfig(IStorageProviderConfig from, IStorageProviderConfig to, string delimiter = null) { Contract.NotNull(from, nameof(from)); Contract.NotNull(to, nameof(to)); this.Delimiter = !String.IsNullOrWhiteSpace(delimiter) ? delimiter : from.Delimiter; this.From = from; this.To = to; }
public MigrationProviderConfig(IStorageProviderConfig from, IStorageProviderConfig to, string delimiter = null) { Contract.NotNull(from, nameof(from)); Contract.NotNull(to, nameof(to)); this.Delimiter = !String.IsNullOrWhiteSpace(delimiter) ? delimiter : from.Delimiter; this.From = from; this.To = to; }
public ReplicatedProviderConfig(IStorageProviderConfig master, IStorageProviderConfig replica, string delimiter = null) { Contract.NotNull(master, nameof(master)); Contract.NotNull(replica, nameof(replica)); this.Delimiter = !String.IsNullOrWhiteSpace(delimiter) ? delimiter : master.Delimiter; this.Master = master; this.Replica = replica; }
private IFileCabinet GetCabinet(IStorageProviderConfig config, string name) { var cabinet = cabinetFactory.GetCabinet(config); if (cabinet == null) { throw new ApplicationException(String.Format("Could not get cabinet for '{0}' config", name)); } return(cabinet); }
private static IFileCabinet CreateFileCabinet(IStorageProviderConfig config, Type configType) { Func <object> providerFactory; if (!providerCache.TryGetValue(configType, out providerFactory)) { throw new Exception("No provider is registered for a config of type: " + configType.FullName); } var provider = providerFactory(); if (provider == null) { throw new Exception("The providerFactory returned null. Factory registered for type: " + configType.FullName); } var cabinetType = typeof(FileCabinet <>); var cabinetGenericType = cabinetType.MakeGenericType(configType); var cabinet = Activator.CreateInstance(cabinetGenericType, provider, config); return(cabinet as IFileCabinet); }
public IStorageProvider GetStorageProvider(string type, IPoolConfig poolConfig, IStorageProviderConfig config) { var @params = new NamedParameterOverloads { { "poolConfig", poolConfig }, { "config", config } }; return(_applicationContext.Container.Resolve <IStorageProvider>(type, @params)); }
public IStorageProvider GetStorageProvider(string type, IPoolConfig poolConfig, IStorageProviderConfig config) { var @params = new NamedParameterOverloads { {"poolConfig", poolConfig}, {"config", config} }; return _applicationContext.Container.Resolve<IStorageProvider>(type, @params); }