Example #1
0
        public ModelTestController <T> GenerateController <T>() where T : DataModel, new()
        {
            if (ORM == null)
            {
                ORM = new ORMManager(Log, "OrmExtension");
            }

            ModelTestRepository <T> Repo       = new ModelTestRepository <T>(ORM);
            ModelTestServices <T>   Service    = new ModelTestServices <T>(Repo);
            ModelTestController <T> Controller = new ModelTestController <T>(Service);

            return(Controller);
        }
Example #2
0
        public void OrmManagerConfigurationTest()
        {
            File.WriteAllText("CONFIG_UNREADABLE.xml", "TEST OF CONFIGURATION");

            ORMManager manager = null;

            Assert.Throws <ConfigurationException>(() => manager = new ORMManager(Log, "OrmExtension", "FileName&#.:\t\n/\\"));

            manager = new ORMManager(Log, "OrmExtension", "CONFIG_OK.xml");
            Assert.True(File.Exists("CONFIG_OK.xml"));

            manager.Config.SelectedDatabase = "Not a database name";
            DataRepository <TestClass <int> > repo = null;

            Assert.Throws <ConfigurationException>(() => repo = manager.Get <TestClass <int> >());
            manager.Config.Configs.Clear();
            manager.Config.SelectedDatabase = "test"; // Correct database name
            Assert.Throws <ConfigurationException>(() => manager.Get <TestClass <int> >());

            Assert.Throws <InvalidOperationException>(() => manager = new ORMManager(Log, "OrmExtension", "CONFIG_UNREADABLE.xml"));
        }
Example #3
0
 public override void SetupOrm()
 {
     Manager = new ORMManager(Log, "OrmExtension", "TestConfigurationReference.xml");
 }
 public ModelTestRepository(ORMManager orm) : base(orm)
 {
 }
Example #5
0
 public AbstractTest(ITestOutputHelper output)
 {
     Log = new TestLogger(output);
     ORM = new ORMManager(Log, "OrmExtension");
 }
Example #6
0
 public UserRepository(ORMManager orm) : base(orm)
 {
 }