public void FindLog() { IMsSqlLogService repository = new MsSqlLogService(); LogController controller = new LogController(repository); // lets create 1 log LogTO log = InsertLog("First Message", "Source 1", LogTO.LogType.Error); // find the log and compare LogTO logFound = controller.FindLog(log.LogId); // if null the issue Assert.IsNotNull(logFound); Assert.AreEqual(log.LogId, logFound.LogId, "LogId found is different"); Assert.AreEqual(log.Message, logFound.Message, "Message inserted is not same"); Assert.AreEqual(log.Source, logFound.Source, "Source is different"); Assert.AreEqual(log.Type, logFound.Type,"Type is not same"); repository.Delete(log.LogId); }
public void DeleteLog() { IMsSqlLogService repository = new MsSqlLogService(); LogController controller = new LogController(repository); // lets create 1 log LogTO log = InsertLog("First Message", "Source 1", LogTO.LogType.Error); // Now lets delete the log repository.Delete(log.LogId); try { // this must raise exception LogTO logFound = controller.FindLog(log.LogId); // above line must throw not found exception, if we are here then // we found the record which is wrong Assert.Fail(); } catch (Exception ex) { } }