예제 #1
0
 public void AddPhone_AddOneNumber()
 {
     PhonebookRepository phonebook = new PhonebookRepository();
     List<string> oneNumber = new List<string> { "+359899777236" };
     bool isAdded = phonebook.AddPhone("Kalina", oneNumber);
     Assert.IsTrue(isAdded);
 }
예제 #2
0
 public void ListTests_Exception()
 {
     SortedSet<string> phoneNumbers = new SortedSet<string> { "+35929811111" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Kalina", phoneNumbers);
     phonebook.ListEntries(10, 10);
 }
예제 #3
0
 public void AddPhone_AddDifferentCaseName_CheckIfMerge()
 {
     List<string> phoneNumbers = new List<string> { "+35929811111" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Kalina", phoneNumbers);
     List<string> otherNumber = new List<string> { "+359899777236" };
     bool isMerge = phonebook.AddPhone("KALINA", otherNumber);
     Assert.IsFalse(isMerge);
 }
예제 #4
0
 public void AddPhone_AddDifferentCaseName_CheckIfNew()
 {
     List<string> phoneNumbers = new List<string> { "+35929811111" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Kalina", phoneNumbers);
     List<string> otherNumber = new List<string> { "+359899777236" };
     bool isNew = phonebook.AddPhone("Ivan", otherNumber);
     Assert.IsTrue(isNew);
 }
 public void ChangePhone_CheckOldNumber()
 {
     List<string> phoneNumbers = new List<string> { "+35929811111" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Kalina", phoneNumbers);
     phonebook.ChangePhone("+35929811000", "+359899777236");
     SortedSet<string> sortedNumbers = phonebook.PhoneEntries[0].PhoneNumbers;
     string actual = string.Join(", ", sortedNumbers);
     Assert.AreEqual("+35929811111", actual);
 }
예제 #6
0
 public void AddPhone_AddOneNumber_CheckForNumbers()
 {
     List<string> phoneNumbers = new List<string> { "+35929811111" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Kalina", phoneNumbers);
     string numbers = "+35929811111";
     SortedSet<string> sortedNumbers = phonebook.PhoneEntries[0].PhoneNumbers;
     string actual = string.Join(", ", sortedNumbers);
     Assert.AreEqual(numbers, actual);
 }
예제 #7
0
 public void ListTests_TestOneChangedNumber()
 {
     SortedSet<string> phoneNumbers = new SortedSet<string> { "+35929811111" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Ivan", phoneNumbers);
     phonebook.ChangePhone("+35929811111", "+359899777235");
     PhoneEntry[] entries = phonebook.ListEntries(0, 1);
     string output = entries[0].ToString();
     string excepted = "[Ivan: +359899777235]";
     Assert.AreEqual(excepted, output);
 }
 public void ChangePhone_ChangePart()
 {
     List<string> phoneNumbers = new List<string> { "+35929811111" };
     List<string> phoneNumbersTwo = new List<string> { "+35929811199" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Kalina", phoneNumbers);
     phonebook.AddPhone("Ivan", phoneNumbersTwo);
     phonebook.AddPhone("Pesho", phoneNumbers);
     phonebook.AddPhone("Gosho", phoneNumbersTwo);
     int numbersChanged = phonebook.ChangePhone("+35929811111", "+359899777236");
     Assert.AreEqual(2, numbersChanged);
 }
 public void ChangePhone_AddChangeMultipleToOne()
 {
     List<string> phoneNumbers = new List<string> { "+35929811111" };
     PhonebookRepository phonebook = new PhonebookRepository();
     List<string> phoneNumbersTwo = new List<string> { "+35929811199" };
     phonebook.AddPhone("Kalina", phoneNumbers);
     phonebook.AddPhone("Ivan", phoneNumbersTwo);
     phonebook.ChangePhone("+35929811111", "+359899777236");
     phonebook.ChangePhone("+35929811199", "+359899777236");
     SortedSet<string> sortedNumbers = phonebook.PhoneEntries[0].PhoneNumbers;
     SortedSet<string> sortedNumbersTwo = phonebook.PhoneEntries[1].PhoneNumbers;
     string actual = string.Join(", ", sortedNumbers);
     string actualTwo = string.Join(", ", sortedNumbersTwo);
     bool hasChangeTwo = actual == actualTwo;
     bool isChanged = "+359899777236" == actual;
     Assert.AreEqual(isChanged, hasChangeTwo);
 }
예제 #10
0
        public void ListTests_TestDifferentNumberOfListedNumber()
        {
            SortedSet<string> phoneNumbers = new SortedSet<string> { "+35929811111" };
            PhonebookRepository phonebook = new PhonebookRepository();
            phonebook.AddPhone("Ivan", phoneNumbers);
            phonebook.AddPhone("Pesho", phoneNumbers);
            PhoneEntry[] entries = phonebook.ListEntries(0, 2);
            bool areAllTrue = true;

            string output = entries[0].ToString();
            string excepted = "[Ivan: +359899777235]";
            string output1 = entries[1].ToString();
            string excepted1 = "[Pesho: +359899777235]";
            if ((output == excepted) && (output1 == excepted1))
            {
                areAllTrue = false;
            }
            Assert.IsTrue(areAllTrue);
        }
예제 #11
0
 public void ListTests_TestThreeNumbers()
 {
     SortedSet<string> phoneNumbers = new SortedSet<string> { "+35929811111", "+359899777235", "+359899777236" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Kalina", phoneNumbers);
     PhoneEntry[] entries = phonebook.ListEntries(0, 1);
     string output = entries[0].ToString();
     string excepted = "[Kalina: +35929811111, +359899777235, +359899777236]";
     Assert.AreEqual(excepted, output);
 }
 public void ChangePhone_HaveTwoOldPhones()
 {
     List<string> phoneNumbers = new List<string> { "+35929811111" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Kalina", phoneNumbers);
     phonebook.AddPhone("Ivan", phoneNumbers);
     int numbersChanged = phonebook.ChangePhone("+35929811111", "+359899777236");
     Assert.AreEqual(2, numbersChanged);
 }
예제 #13
0
 public void AddPhone_AddSameNumber()
 {
     List<string> phoneNumbers = new List<string> { "+35929811111" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Kalina", phoneNumbers);
     List<string> sameNumber = new List<string> { "+359899777236" };
     bool isSameAdded = phonebook.AddPhone("Kalina", sameNumber);
     Assert.IsFalse(isSameAdded);
 }
예제 #14
0
 public void AddPhone_AddNullNumber()
 {
     PhonebookRepository phonebook = new PhonebookRepository();
     bool isAdded = phonebook.AddPhone("Kalina", null);
 }
예제 #15
0
 public void AddPhone_AddEmptyNumber()
 {
     List<string> phoneNumbers = new List<string> { "" };
     PhonebookRepository phonebook = new PhonebookRepository();
     bool isAdded = phonebook.AddPhone("Kalina", phoneNumbers);
 }
        public void ChangePhone_GiveNullAsParams()
        {
            List<string> phoneNumbers = new List<string> { "+35929811111" };

            PhonebookRepository phonebook = new PhonebookRepository();
            phonebook.AddPhone("Kalina", phoneNumbers);
            int numbersChanged = phonebook.ChangePhone(null, "+359899777236");
        }
예제 #17
0
 public void AddPhone_MergeTest()
 {
     List<string> phoneNumbers = new List<string> { "+35929811111" };
     PhonebookRepository phonebook = new PhonebookRepository();
     phonebook.AddPhone("Kalina", phoneNumbers);
     List<string> mergeOne = new List<string> { "+359899123236" };
     List<string> difNumber = new List<string> { "+359899900006" };
     phonebook.AddPhone("Kalina", mergeOne);
     bool isMerged = phonebook.AddPhone("Kalina", difNumber);
     Assert.IsFalse(isMerged);
 }