public void EndToEnd() { var expected = CelestialBody.All.ToArray(); var records = expected.Select(Flatten); var writer = new SimpleCsvWriter(); string csv = null; using (var target = new StringWriter()) { writer.Write(records, target); csv = target.ToString(); } var schema = new List <FieldDefinition> { "Name" }; schema.AddEnum <CelestialBodyType>("Type"); schema.Add("Mass", float.Parse); schema.Add("Distance to Primary", float.Parse); var actual = new List <CelestialBody>(); using (var source = new StringReader(csv)) using (var reader = new CsvDataReader(source, schema, Parser.Create())) { while (reader.Read()) { actual.Add(new CelestialBody { Name = reader.GetFieldValue <string>(0), Type = reader.GetFieldValue <CelestialBodyType>(1), Mass = reader.GetFieldValue <float>(2), Orbit = new OrbitalInfo { DistanceToPrimary = reader.GetFieldValue <float>(3) } }); } } actual.ShouldBeSameSequenceAs(expected); }