コード例 #1
0
        public void SearchByPhoneNumber_EntityExists_Last()
        {
            ListBox         listBox1        = new ListBox();
            ListBox         listBox2        = new ListBox();
            ListBox         listBox3        = new ListBox();
            MyDataStructure myDataStructure = new MyDataStructure(listBox1, listBox2, listBox3);

            myDataStructure.addEntry("111111", "FirstBoy1", "LastBoy1");
            myDataStructure.addEntry("111115", "FirstBoy5", "LastBoy5");
            myDataStructure.addEntry("111114", "FirstBoy4", "LastBoy4");
            myDataStructure.addEntry("111113", "FirstBoy3", "LastBoy3");
            myDataStructure.addEntry("111116", "FirstBoy6", "LastBoy6");
            myDataStructure.addEntry("111112", "FirstBoy2", "LastBoy2");
            int searchIndex = myDataStructure.searchPhoneNumber("111116");

            Assert.AreEqual(5, searchIndex);
        }
コード例 #2
0
        public void SearchByLastName_EntityNotExists()
        {
            ListBox         listBox1        = new ListBox();
            ListBox         listBox2        = new ListBox();
            ListBox         listBox3        = new ListBox();
            MyDataStructure myDataStructure = new MyDataStructure(listBox1, listBox2, listBox3);

            myDataStructure.addEntry("111111", "FirstBoy1", "LastBoy1");
            myDataStructure.addEntry("111115", "FirstBoy5", "LastBoy5");
            myDataStructure.addEntry("111114", "FirstBoy4", "LastBoy4");
            myDataStructure.addEntry("111113", "FirstBoy3", "LastBoy3");
            myDataStructure.addEntry("111116", "FirstBoy6", "LastBoy6");
            myDataStructure.addEntry("111112", "FirstBoy2", "LastBoy2");
            int searchIndex = myDataStructure.searchLastName("LastBoy7");

            Assert.AreEqual(-1, searchIndex);
        }