public void SerializerGetSerializerEnumerableWithColumnHeaderTest() { var list = new List <DummyData> { new DummyData { Property1 = 1, Property2 = "One" }, new DummyData { Property1 = 2, Property2 = "Two" } }; var serializer = new CsvSerializer <DummyData>(";", "-", true); serializer.AddColumn("ColumnOne", x => x.Property1.ToString()); serializer.AddColumn("ColumnTwo", x => x.Property2); var rows = serializer.GetRows(list); Assert.AreEqual(3, rows.Count()); }
public void SerializerSerializeDataWithoutColumnHeaderTest() { var list = new List <DummyData> { new DummyData { Property1 = 1, Property2 = "One" }, new DummyData { Property1 = 2, Property2 = "Two" } }; var serializer = new CsvSerializer <DummyData>(";", "-", false); serializer.AddColumn("ColumnOne", x => x.Property1.ToString()); serializer.AddColumn("ColumnTwo", x => x.Property2); var serializedString = serializer.Serialize(list); Assert.AreEqual("1;One-2;Two-", serializedString); }