예제 #1
0
        public void IndexOfTest()
        {
            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(0, document.IndexOf(new Person {
                Name = "Akari", Age = 20
            }));
            Assert.AreEqual(1, document.IndexOf(new Person {
                Name = "Kyoko", Age = 21
            }));
            Assert.AreEqual(2, document.IndexOf(new Person {
                Name = "Yui", Age = 22
            }));
            Assert.AreEqual(3, document.IndexOf(new Person {
                Name = "Chinatsu", Age = 19
            }));

            Assert.AreEqual(-1, document.IndexOf(new Person {
                Name = "Ayano", Age = 19
            }));
        }