public void WriterTextConvertToEnumClass() { var data = new List <MemberProfile> { new MemberProfile { Id = 1, Name = "Charlie", Address = "Taiwan, Tainan", MemberType = MemberType.General }, new MemberProfile { Id = 2, Name = "Charlie", Address = "Taiwan, Tainan", MemberType = MemberType.Gold } }; var exp = new StringWriter(); exp.WriteLine("01Charlie Taiwan, Tainan N"); exp.WriteLine("02Charlie Taiwan, Tainan G"); var act = new StringWriter(); var helper = new DataRowConvert(act); helper.WriteRecods(data); Assert.AreEqual(exp.ToString(), act.ToString()); }
public void ReaderTextConvertToGeneralClass() { var exp = new List <Profile> { new Profile { Id = 1, Name = "Charlie", Address = "Taiwan, Tainan" }, new Profile { Id = 2, Name = "Charlie", Address = "Taiwan, Tainan" } }; var data = "01Charlie Taiwan, Tainan \n02Charlie Taiwan, Tainan \n"; var helper = new DataRowConvert(new StringReader(data)); var act = helper.ReadRecords <Profile>(); Assert.AreEqual(JsonConvert.SerializeObject(exp), JsonConvert.SerializeObject(act)); }