Exemplo n.º 1
0
        public void TestVoluntarioModelInjection()
        {
            IVoluntarioPersistence          voluntarioPersistence = null;
            VoluntarioPersistenceIocManager iocManager            = new VoluntarioPersistenceIocManager(base.Config);

            voluntarioPersistence = iocManager.GetCurrentIVoluntarioPersitenceImplementation();
            Assert.IsNotNull(voluntarioPersistence);

            Assert.IsTrue(voluntarioPersistence.GetType().IsClass);
        }
Exemplo n.º 2
0
        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);
        }