Example #1
0
 public void ProcessLojackImportRecordTest()
 {
     var importer = new LojackDataImporter();
     var tracerIds = importer.GetExistingComputraceIds(Connection);
     var blacklisted = importer.GetBlacklistedSerials(Connection);
     var readerLine = "3,6640hur10799,,,1997-05-28 00:00:00.000,1997-05-28 00:00:00.000,97-99708,,Compaq,Armada";
     var processor = importer.ProcessLojackImportRecord(Connection, tracerIds, blacklisted, readerLine, 0);
     Assert.IsTrue(processor == 0);
     int secondsSinceMidnight = Convert.ToInt32(DateTime.Now.Subtract(DateTime.Today).TotalSeconds);
     var rand = new Random(secondsSinceMidnight);
     var newRandom = rand.Next(800000, 1200000);
     readerLine = newRandom.ToString() +
                  ",6640test0799,,,1997-05-28 00:00:00.000,1997-05-28 00:00:00.000,97-99708,,Compaq,Armada";
     processor = importer.ProcessLojackImportRecord(Connection, tracerIds, blacklisted, readerLine, 0);
     Assert.IsTrue(processor == 1);
 }
Example #2
0
        private static void Main(string[] args)
        {
            string path = Lojack.Properties.Settings.Default.ImportDirectory;

            string[] files = Directory.GetFiles(path);

            using (var conn = RPDSS.Data.SQLUtility.GetConnection())
            {
                var lojackImporter = new LojackDataImporter();
                var blacklistedSerials = lojackImporter.GetBlacklistedSerials(conn);
                var existingComputraceIDs = lojackImporter.GetExistingComputraceIds(conn);
                lojackImporter.ProcessImportFiles(files, existingComputraceIDs, conn, blacklistedSerials);
                lojackImporter.FindMatchedRecordsandAddToDatabase();

            }
        }
Example #3
0
 public void GetExistingComputraceIdsTest()
 {
     var importer = new LojackDataImporter();
     var traceIds = importer.GetExistingComputraceIds(Connection);
     Assert.IsTrue(traceIds.Any());
 }
Example #4
0
 public void GetBlacklistedSerialsTest()
 {
     var importer = new LojackDataImporter();
     var blacklisted = importer.GetBlacklistedSerials(Connection);
     Assert.IsTrue(blacklisted.Count > 0);
 }