コード例 #1
0
        public void TestFindUserById(string name, long id)
        {
            IPerson  person1 = new Person("asd", 234);
            IPerson  person2 = new Person("asDa", 2346);
            Database db      = new Database(person1, person, person2);

            string foundPersonName = db.FindByUserId(id).Name;

            Assert.AreEqual(name, foundPersonName);
        }
コード例 #2
0
        public void TestFindUserByIdThrowsArgumentOutOfRangeException()
        {
            IPerson  person1      = new Person("asd", 234);
            IPerson  person2      = new Person("asDa", 2346);
            Database db           = new Database(person1, person, person2);
            bool     CorrectError = false;

            try
            {
                IPerson foundPersonName = db.FindByUserId(-1);
            }
            catch (ArgumentOutOfRangeException)
            {
                CorrectError = true;
            }
            Assert.IsTrue(CorrectError);
        }