public void InsertLojackAuditProcessTest() { var rep = new LojackAuditProcessRepository(new LojackContext()); var audit = new LojackAuditProcess { FileName = "test.csv", ModificationDate = DateTime.Now, ProcessDateTime = DateTime.Now, RecordsProcessed = 10, Status = "Fine" }; var record = rep.Insert(audit); Assert.IsTrue(record.LojackAuditProcessId > 0); }
public void GetLojackAuditProcessTest() { var rep = new LojackAuditProcessRepository(new LojackContext()); var audit = new LojackAuditProcess { FileName = "test.csv", ModificationDate = DateTime.Now, ProcessDateTime = DateTime.Now, RecordsProcessed = 10, TotalRecords = 100, Status = "Tested" }; var record = rep.Insert(audit); var found = rep.FindByFileName(record.FileName); Assert.IsTrue(found); found = rep.FindByFileName("notfound.csv"); Assert.IsFalse(found); }
public void GetByDateRangeTest() { var rep = new LojackAuditProcessRepository(new LojackContext()); var data = rep.GetByDateRange(DateTime.Today.AddDays(-7), DateTime.Today).ToList(); Assert.IsTrue(data.Any()); }
public void GetAllTest() { var rep = new LojackAuditProcessRepository(new LojackContext()); var data = rep.GetAll().ToList(); Assert.IsTrue(data.Any()); }
private static void InsertLojackAuditRecord(string file, int counter, int totalRecords) { using (var db = new LojackContext()) { var rep = new LojackAuditProcessRepository(db); var lojack = new LojackAuditProcess { FileName = file, ModificationDate = DateTime.Now, ProcessDateTime = DateTime.Now, RecordsProcessed = counter, TotalRecords = totalRecords, Status = "Processed" }; rep.Insert(lojack); } }
public void ProcessImportFiles(IEnumerable<string> files, List<string> existingComputraceIDs, SqlConnection conn, List<string> blacklistedSerials) { var rep = new LojackAuditProcessRepository(new LojackContext()); foreach (string file in files) { if (rep.FindByFileName(file)) { var counter = ProcessImportFile(existingComputraceIDs, conn, blacklistedSerials, file); InsertLojackAuditRecord(file, counter, TotalRecords); } } }