public void Test_Map_Object_DataType_To_Strongly_Type_Class() { var dataReader = GetData().CreateDataReader(); var list = dataReader.MapToList <DateTimeOffsetDataType>(); var instance = list.First(); MyAccessor.GetMembers().ToList().ForEach(delegate(Member member) { var expectedValue = MyAccessor[Instance, member.Name]; var actualValue = MyAccessor[instance, member.Name]; Assert.AreEqual(expectedValue, actualValue, $"MapToList gave the property {member.Name} The wrong value. Expected {expectedValue} but it was {actualValue}"); }); }
private static DataTable GetData() { var table = new DataTable(); MyAccessor.GetMembers().ToList().ForEach(delegate(Member member) { table.Columns.Add(member.Name, IsNullable(member.Type)); }); var values = new List <object>() { }; MyAccessor.GetMembers().ToList().ForEach(delegate(Member member) { values.Add(MyAccessor[Instance, member.Name]); }); table.Rows.Add(values.ToArray()); table.AcceptChanges(); return(table); }