public static void ClassInitialize(TestContext testContext) { //DatabaseInitializer.InitializeDatabase(); // Set up the LogManager once SqlLogAdapter adapter = new SqlLogAdapter(STR_ConnectionString); adapter.LogFilename = STR_TestLogFile; LogManager.Create(adapter); }
public void CreateDeleteLogWithSqlAdapterTest() { SqlLogAdapter adapter = new SqlLogAdapter(STR_ConnectionString); adapter.LogFilename = "ApplicationLog2"; bool res = adapter.CreateLog(); Assert.IsTrue(res, "Application Log not Created"); res = adapter.DeleteLog(); Assert.IsTrue(res, "Application Log not deleted"); }
public void WriteLogEntryWithAdapterTest() { SqlLogAdapter adapter = new SqlLogAdapter(STR_ConnectionString); adapter.LogFilename = STR_TestLogFile; WebLogEntry entry = new WebLogEntry(); entry.ErrorLevel = ErrorLevels.Info; entry.Message = "Testing " + DateTime.Now.ToString(); bool res = adapter.WriteEntry(entry); //bool res = adapter.WriteEntry(entry); Assert.IsTrue(res, "Entry couldn't be written to database"); LogEntry entry2 = adapter.GetEntry(entry.Id); Assert.IsTrue(entry.Message == entry2.Message); Assert.IsTrue(entry.ErrorLevel == entry2.ErrorLevel); }