예제 #1
0
        public void DuplicateNumberTest()
        {
            IPhoneNumber duplicatedNumber = new PhoneNumber("646-123-4567");
            IPhoneNumber duplicatedNumberCopy = new PhoneNumber("646-123-4567");

            IContact contact = new MockContact("Johnny", "DoubleNumber", duplicatedNumber);
            IContact contactDuplicate = new MockContact("Johnny", "DoubleNumber", duplicatedNumberCopy);
            MergedContact mergedContact = new MergedContact(contact, contactDuplicate);

            Assert.AreEqual(1, mergedContact.PhoneNumbers.Count);
        }
예제 #2
0
        public void TestEquals()
        {
            IContact davolaCell = DummyConversationDataGenerator.GetContact(DummyPhoneNumberId.DavolaCell);
            IContact davolaiPhone = DummyConversationDataGenerator.GetContact(DummyPhoneNumberId.DavolaiPhone);

            MergedContact mergedContact = new MergedContact(davolaCell, davolaiPhone);
            MergedContact mergedContactCopy = new MergedContact(davolaCell, davolaiPhone);
            MergedContact mergedContactReverseOrder = new MergedContact(davolaiPhone, davolaCell);

            Assert.AreEqual(mergedContact, mergedContact);
            Assert.AreEqual(mergedContact, mergedContactCopy);
            Assert.AreEqual(mergedContact, mergedContactReverseOrder);
        }
예제 #3
0
        public void CreateTripleNumberContactTest()
        {
            const string firstName = "Ben";
            const string lastName = "Stiller";

            IPhoneNumber phoneNumberA = new PhoneNumber("212-845-0923");
            IPhoneNumber phoneNumberB = new PhoneNumber("212-845-0924");
            IPhoneNumber phoneNumberC = new PhoneNumber("212-845-0925");

            IContact contactA = new MockContact(firstName, lastName, phoneNumberA);
            IContact contactB = new MockContact(firstName, lastName, phoneNumberB);
            IContact contactC = new MockContact(firstName, lastName, phoneNumberC);

            MergedContact contactMergedAB = new MergedContact(contactA, contactB);
            Assert.AreEqual(2, contactMergedAB.PhoneNumbers.Count);
            Assert.IsTrue(contactMergedAB.PhoneNumbers.Contains(phoneNumberA));
            Assert.IsTrue(contactMergedAB.PhoneNumbers.Contains(phoneNumberB));

            MergedContact contactMergedABC = new MergedContact(contactMergedAB, contactC);
            Assert.AreEqual(3, contactMergedABC.PhoneNumbers.Count);
            Assert.IsTrue(contactMergedABC.PhoneNumbers.Contains(phoneNumberA));
            Assert.IsTrue(contactMergedABC.PhoneNumbers.Contains(phoneNumberB));
            Assert.IsTrue(contactMergedABC.PhoneNumbers.Contains(phoneNumberC));
        }