public void TestChangePhoneWithMerge()
 {
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Nakov", new string[] { "+359887333555", "+359887333999" });
     phonebook.AddPhone("Ina", new string[] { "+359887333999" });
     phonebook.AddPhone("Ani", new string[] { "+359887333555", "359887333444" });
     int changedPhonesCount = phonebook.ChangePhone("+359887333999", "+359887333555");
     Assert.AreEqual(2, changedPhonesCount);
     string expectedResult =
         "[Ani: +359887333555, 359887333444]; [Ina: +359887333555]; [Nakov: +359887333555]";
     PhonebookEntry[] listedEntries = phonebook.ListEntries(0, 3);
     string actualResult = string.Join("; ", (object[])listedEntries);
     Assert.AreEqual(expectedResult, actualResult);
 }
 public void TestChangeSharedPhone()
 {
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Nakov", new string[] { "+359887333555", "+3592981981" });
     phonebook.AddPhone("Ina", new string[] { "+3592981981" });
     phonebook.AddPhone("Aneliya", new string[] { "+3592981981" });
     phonebook.AddPhone("Niki", new string[] { "+3592981981", "+359999888777" });
     int changedPhonesCount = phonebook.ChangePhone("+3592981981", "+3592982982");
     Assert.AreEqual(4, changedPhonesCount);
     string expectedResult =
         "[Aneliya: +3592982982]; [Ina: +3592982982]; [Nakov: +3592982982, +359887333555]; " +
         "[Niki: +3592982982, +359999888777]";
     PhonebookEntry[] listedEntries = phonebook.ListEntries(0, 4);
     string actualResult = string.Join("; ", (object[])listedEntries);
     Assert.AreEqual(expectedResult, actualResult);
 }
 public void TestChangeSingleNonExistingPhone()
 {
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Nakov", new string[] { "+359887333555" });
     phonebook.AddPhone("Niki", new string[] { "+359887333666" });
     int changedPhonesCount = phonebook.ChangePhone("+359887333777", "+359888888888");
     Assert.AreEqual(0, changedPhonesCount);
     string expectedResult = "[Nakov: +359887333555]; [Niki: +359887333666]";
     PhonebookEntry[] listedEntries = phonebook.ListEntries(0, 2);
     string actualResult = string.Join("; ", (object[])listedEntries);
     Assert.AreEqual(expectedResult, actualResult);
 }