Пример #1
0
        public void UpdateTest()
        {
            var document = new CsvDocument(new string[] { "name", "age" });

            document.WriteWith(new { Name = "Light", Age = "18" });
            document.WriteWith(new { Name = "Misa", Age = "20" });

            document.Update(1, new string[] { "Misa", "17" });
            Assert.AreEqual(2, document.Count);
        }
Пример #2
0
        public void UpdateTest()
        {
            var document = new CsvDocument <Person>();

            document.Write(new Person {
                Name = "Akari", Age = 20
            });
            document.Write(new Person {
                Name = "Mirakurun", Age = 19
            });

            document.Update(1, new Person {
                Name = "Yui", Age = 20
            });

            Assert.AreEqual(2, document.Count);
            Assert.IsFalse(document.IsEmpty);

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