public void GetEnumeratorTest() { var document = new CsvDocument <Person>(new Person[] { new Person { Name = "Akari", Age = 20 }, new Person { Name = "Kyoko", Age = 21 }, new Person { Name = "Yui", Age = 22 }, }); var enumerator = document.GetEnumerator(); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(CsvRecord.From(new { Name = "Akari", Age = 20 }), enumerator.Current); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(CsvRecord.From(new { Name = "Kyoko", Age = 21 }), enumerator.Current); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(CsvRecord.From(new { Name = "Yui", Age = 22 }), enumerator.Current); Assert.IsFalse(enumerator.MoveNext()); }
public void GetEnumeratorTest() { var document = new CsvDocument(new string[] { "name", "age" }); document.Write("Light", 18); document.Write("Misa", 20); var enumerator = document.GetEnumerator(); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual("Light,18", enumerator.Current.ToString()); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual("Misa,20", enumerator.Current.ToString()); Assert.IsFalse(enumerator.MoveNext()); }