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); }
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")); }
public override void SetupOrm() { Manager = new ORMManager(Log, "OrmExtension", "TestConfigurationReference.xml"); }
public ModelTestRepository(ORMManager orm) : base(orm) { }
public AbstractTest(ITestOutputHelper output) { Log = new TestLogger(output); ORM = new ORMManager(Log, "OrmExtension"); }
public UserRepository(ORMManager orm) : base(orm) { }