public void DatabaseService_FillStaticQueryLibrary_Success() { // Query Library Only TestDatabaseService.FillStaticQueryLibrary(typeof(TestDatabaseQueryProvider)); Assert.IsNotNull(TestDatabaseService.StaticQueries, "The static queries should not have been null"); Assert.AreEqual(2, TestDatabaseService.StaticQueries.Count, "There should be two queries in the library"); Assert.IsTrue(TestDatabaseService.StaticQueries.ContainsKey("test1.query1"), "Query 1 not found"); Assert.IsTrue(TestDatabaseService.StaticQueries.ContainsKey("test1.query2"), "Query 2 not found"); // Query Library / Fragment Library specified ClearStaticQueryLibrary(); // (note: this call will do nothing with the fragments; we're looking for NPEs and such) TestDatabaseService.FillStaticQueryLibrary(typeof(TestFragmentProvider), typeof(TestDatabaseQueryProvider)); // Query/Fragment Library combined ClearStaticQueryLibrary(); TestDatabaseService.FillStaticQueryLibrary(typeof(TestQueryAndFragmentProvider)); Assert.AreEqual(1, TestDatabaseService.StaticQueries.Count, "There should be one query in the library"); Assert.IsTrue(TestDatabaseService.StaticQueries.ContainsKey("test2.query1"), "Query 1 not found"); Assert.AreEqual("SELECT from some_table after_from", TestDatabaseService.StaticQueries["test2.query1"].SQL, "Fragmented query was not assembled correctly"); }
public ActionResult Index() { TestDatabaseService a = new TestDatabaseService(); //a.DoInsertQuery(); //a.DoGetQuery(); return(View()); }