public void TestVoluntarioModelInjection() { IVoluntarioPersistence voluntarioPersistence = null; VoluntarioPersistenceIocManager iocManager = new VoluntarioPersistenceIocManager(base.Config); voluntarioPersistence = iocManager.GetCurrentIVoluntarioPersitenceImplementation(); Assert.IsNotNull(voluntarioPersistence); Assert.IsTrue(voluntarioPersistence.GetType().IsClass); }
public IVoluntarioPersistence GetCurrentImplementation() { IVoluntarioPersistence obj = null; foreach (var type in typeof(IVoluntarioPersistence).Assembly.DefinedTypes) { if (type.IsClass && type.FullName.EndsWith(_currentImplementation)) { obj = (IVoluntarioPersistence)Assembly.Load(typeof(IVoluntarioPersistence).Assembly.FullName).CreateInstance(type.FullName); break; } } return(obj); }