コード例 #1
0
        public void WriteAtTest()
        {
            var document = new CsvDocument(new string[] { "name", "age" });

            document.Write("Light", 18);
            document.Write("Misa", 20);

            document.WriteAt(0, new string[] { "Ryuk", "999" });

            Assert.IsFalse(document.IsEmpty);
            Assert.AreEqual(3, document.Count);
        }
コード例 #2
0
        public void WriteAtTest()
        {
            var document = new CsvDocument <Person>();

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

            document.WriteAt(1, new Person {
                Name = "Yui", Age = 20
            });
            Assert.AreEqual(3, 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]);
            Assert.AreEqual(new CsvRecord(document.Header, new string[] { "Mirakurun", "19" }), document[2]);
        }