public void MultipleRowsExistInPrsErrorMonitorTable_LastRowIsReturned() { _reportingMockContext.tbPRSErrorMonitor.AddObject(TestHelpers.PopulateDatabaseTables.AddRowTotbPrsErrorMonitor.AddTableRow(DateTime.Now.AddHours(-5))); _reportingMockContext.tbPRSErrorMonitor.AddObject(TestHelpers.PopulateDatabaseTables.AddRowTotbPrsErrorMonitor.AddTableRow(DateTime.Now.AddHours(-1))); _reportingMockContext.tbPRSErrorMonitor.AddObject(TestHelpers.PopulateDatabaseTables.AddRowTotbPrsErrorMonitor.AddTableRow(DateTime.Now.AddMinutes(-30))); _reportingMockContext.tbPRSErrorMonitor.AddObject(TestHelpers.PopulateDatabaseTables.AddRowTotbPrsErrorMonitor.AddTableRow(DateTime.Now.AddMinutes(-5))); tbPRSErrorMonitor _latestRow = _repository.RetrieveLatestRowFromPrsErrorMonitorTable(); // Deceided to take approach below rather than try to scrub off the milliseconds Assert.AreEqual(DateTime.Now.Date, _latestRow.DateTime.Date, "Date did not match"); Assert.AreEqual(DateTime.Now.Hour, _latestRow.DateTime.Hour, "Hour did not match"); Assert.AreEqual(DateTime.Now.AddMinutes(-5).Minute, _latestRow.DateTime.Minute, "Minute did not match"); Assert.AreEqual(DateTime.Now.Second, _latestRow.DateTime.Second, "Second did not match"); }