public void TestChangeMultiplePhoneMustReturnNumberOfChangedPhones() { var test = new PhonebookRepository(); test.AddPhone("Pesho", new[] { "08895624", "08895625", "08895626" }); test.AddPhone("Gosho", new[] { "08895624", "08895625", "08895626" }); int changedPhones = test.ChangePhone("08895624", "08895628"); Assert.AreEqual(2, changedPhones); }
public void TestMethodWithValidStartPositionAndCount() { var test = new PhonebookRepository(); test.AddPhone("Pesho", new[] { "08895624", "08895625", "08895626" }); test.AddPhone("Gosho", new[] { "08895624", "08895625", "08895626" }); test.AddPhone("Mara", new[] { "08895624", "08895625", "08895626" }); var result = test.ListEntries(0, 3); int returnedEntriesCount = result.Length; Assert.AreEqual(3, returnedEntriesCount); }
public void TestAddDuplicatePhonebookEntryWithSameNumberMustChangeNothing() { var test = new PhonebookRepository(); test.AddPhone("Pesho", new[] { "08895624" }); test.AddPhone("Pesho", new[] { "08895624" }); int entriesCount = test.PhoneEntrySortedCount; int numbersCount = test.KeyNumberValueEntryCount; Assert.AreEqual(1, entriesCount); Assert.AreEqual(1, numbersCount); }
public void TestAddDuplicatePhonebookEntryWithDiferentNumberMustMergeNumbers() { var test = new PhonebookRepository(); test.AddPhone("Pesho", new[] { "08895624" }); bool isNewNumber = test.AddPhone("Pesho", new[] { "08895625" }); int entriesCount = test.PhoneEntrySortedCount; int numbersCount = test.KeyNumberValueEntryCount; Assert.AreEqual(false, isNewNumber); Assert.AreEqual(1, entriesCount); Assert.AreEqual(2, numbersCount); }
public void TestAddUniquePhonebookEntryWithMultipleNumbers() { var test = new PhonebookRepository(); test.AddPhone("Pesho", new[] { "08895624", "08895625", "08895626" }); int numbersCount = test.KeyNumberValueEntryCount; Assert.AreEqual(3, numbersCount); }
public void TestMethodWithInvalidStartPositionShouldReturnNull() { var test = new PhonebookRepository(); test.AddPhone("Pesho", new[] { "08895624", "08895625", "08895626" }); var result=test.ListEntries(2, 1); Assert.AreEqual(null, result); }
public void TestAddUniquePhonebookEntryWithSingleNumber() { var test = new PhonebookRepository(); bool isNewNumber = test.AddPhone("Pesho", new[] { "08895624" }); int entriesCount = test.PhoneEntrySortedCount; int numbersCount = test.KeyNumberValueEntryCount; Assert.AreEqual(true, isNewNumber); Assert.AreEqual(1, entriesCount); }
public void TestChangeSinglePhoneMustReturnNumberOfChangedPhones() { var test = new PhonebookRepository(); test.AddPhone("Pesho", new[] { "08895624", "08895625", "08895626" }); int changedPhones = test.ChangePhone("08895624", "08895628"); Assert.AreEqual(1, changedPhones); // Number of phones should stay unchanged Assert.AreEqual(3, test.KeyNumberValueEntryCount); }