示例#1
0
        public void ModifyPhone()
        {
            PhoneBook phoneBook = new PhoneBook();
            phoneBook.Add("Nick", "0744596866");
            phoneBook.Add("John Smith", "0745516", "3gd");

            KeyValuePair<string, Contact> contactToCompare = new KeyValuePair<string, Contact>("3gd", new Contact("John Smith", "0744578999"));
            KeyValuePair<string, Contact> contactToModify = phoneBook.Modify(id: "3gd", phoneNumber: "0744578999");

            Assert.AreEqual(contactToCompare, contactToModify);
        }
示例#2
0
        public void ModifyNameWhenKeyDoesNotExist()
        {
            PhoneBook phoneBook = new PhoneBook();
            phoneBook.Add("Nick", "0744596866");
            phoneBook.Add("John Smith", "0745516", "3gd");

            KeyValuePair<string, Contact> contactToCompare = new KeyValuePair<string, Contact>("3gd", new Contact("Johnny 2", "0745516"));
            KeyValuePair<string, Contact> contactToModify = phoneBook.Modify(id: "3gd", name: "Johnny");

            Assert.AreNotEqual(contactToCompare, contactToModify);
        }