Esempio n. 1
0
        public void RemoveAllTest()
        {
            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
                },
                new Person {
                    Name = "Chinatsu", Age = 19
                }
            });

            Assert.AreEqual(4, document.Count);
            Assert.AreEqual(2, document.RemoveAll(e => e.Age > 20));
            Assert.AreEqual(2, document.Count);


            Assert.AreEqual(new CsvRecord(document.Header, new string[] { "Akari", "20" }), document[0]);
            Assert.AreEqual(new CsvRecord(document.Header, new string[] { "Chinatsu", "19" }), document[1]);
        }