public void t_Load_SiteVisit_Normal() { DataTable table = new DataTable(); table.Columns.Add("Id", typeof(Guid)); table.Columns.Add("EndTime", typeof(DateTime)); table.Columns.Add("LocationId", typeof(Guid)); table.Columns.Add("StartTime", typeof(DateTime)); table.Columns.Add("ObserverId", typeof(Guid)); table.Columns.Add("RecorderId", typeof(Guid)); Guid id = TestHelper.TestGuid1; Guid locationId = TestHelper.TestGuid2; DateTime?start = DateTime.Now; DateTime?end = DateTime.Now.AddHours(1); Guid observer = TestHelper.TestGuid3; Guid recorder = TestHelper.TestGuid4; DataRow row = table.NewRow(); row["Id"] = id; row["EndTime"] = end; row["LocationId"] = locationId; row["StartTime"] = start; row["ObserverId"] = observer; row["RecorderId"] = recorder; table.Rows.Add(row); IDataReader reader = table.CreateDataReader(); Assert.IsTrue(reader.Read(), "Reader failed"); SiteVisit survey = new SiteVisit(); EventBaseMapper.Load(reader, survey); Assert.IsNotNull(survey, "Survey object is null"); Assert.AreEqual(id, survey.Id, "Id"); Assert.AreEqual(locationId, survey.LocationId, "LocationId"); Assert.AreEqual(start, survey.StartTimeStamp, "StartTimeStamp"); Assert.AreEqual(end, survey.EndTimeStamp, "EndTimeStamp"); }
public void t_Load_50m_Normal() { DataTable table = new DataTable(); table.Columns.Add("Id", typeof(Guid)); table.Columns.Add("EndTime", typeof(DateTime)); table.Columns.Add("LocationId", typeof(Guid)); table.Columns.Add("StartTime", typeof(DateTime)); table.Columns.Add("NoiseCode", typeof(byte)); table.Columns.Add("IsDataEntryComplete", typeof(bool)); Guid id = TestHelper.TestGuid1; Guid locationId = TestHelper.TestGuid2; DateTime?start = DateTime.Now; DateTime?end = DateTime.Now.AddHours(1); DataRow row = table.NewRow(); row["Id"] = id; row["EndTime"] = end; row["LocationId"] = locationId; row["StartTime"] = start; row["NoiseCode"] = 1; row["IsDataEntryComplete"] = true; table.Rows.Add(row); IDataReader reader = table.CreateDataReader(); Assert.IsTrue(reader.Read(), "Reader failed"); FiftyMeterPointSurvey survey = new FiftyMeterPointSurvey(); EventBaseMapper.Load(reader, survey); Assert.IsNotNull(survey, "Survey object is null"); Assert.AreEqual(id, survey.Id, "Id"); Assert.AreEqual(locationId, survey.LocationId, "LocationId"); Assert.AreEqual(start, survey.StartTimeStamp, "StartTimeStamp"); Assert.AreEqual(end, survey.EndTimeStamp, "EndTimeStamp"); }