public void GetRecordTest() { VisitorTableController target = new VisitorTableController(); Dictionary<string, object> expected = new Dictionary<string, object>(); expected.Add("ID", Convert.ToInt32(visId)); expected.Add("Name", visName); expected.Add("TimeIn", timeIn); expected.Add("TimeOut", timeOut); Dictionary<string, object> actual; actual = target.GetRecord(visId, today); Assert.IsTrue(recordCompare( expected, actual ) ); }
public void GetRecsForReportTest() { VisitorTableController target = new VisitorTableController(); DateTime start = new DateTime( today.Year, today.Month, today.Day - 2 ); DateTime end = new DateTime(today.Year, today.Month, today.Day - 1 ); List<Dictionary<string, object>> expected = new List<Dictionary<string, object>>(); expected.Add(target.GetRecord(visId, start)); expected.Add(target.GetRecord(visId, end)); List<Dictionary<string, object>> actual; actual = target.GetRecsForReport(start, end); Assert.AreEqual(actual.Count, expected.Count); foreach (Dictionary<string, object> rec in expected) { Assert.IsTrue(recordCompare(rec, actual[expected.IndexOf(rec)])); } }
public void WriteRecordTest() { VisitorTableController target = new VisitorTableController(); // TODO: Initialize to an appropriate value Dictionary<string, object> record = new Dictionary<string, object>(); record.Add("ID", visId); record.Add("Name", visName); record.Add("TimeIn", timeIn); record.Add("TimeOut", timeOut); target.WriteRecord(record); Assert.IsTrue( recordCompare( record, target.GetRecord(visId, today ) ) ); }