예제 #1
0
        public void PersonDeletePhone()
        {
            string name     = "maichao";
            string company  = "ynu";
            string position = "student";

            Person person = new Person {
                Name = name, Company = company, Position = position
            };

            Pair <string, string> num1 = new Pair <string, string>("187", "cellphone");
            Pair <Guid, Pair <string, string> > phone1 = new Pair <Guid, Pair <string, string> >(Guid.NewGuid(), num1);

            person.AddPhone(phone1);

            Pair <string, string> num2 = new Pair <string, string>("187", "cellphone");
            Pair <Guid, Pair <string, string> > phone2 = new Pair <Guid, Pair <string, string> >(Guid.NewGuid(), num2);

            person.AddPhone(phone2);

            person.DeletePhoneById(new Guid(phone1.Key.ToString()));

            Assert.AreEqual(1, person.Phones.Count);
        }