Exemplo n.º 1
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));
        }
Exemplo n.º 2
0
        public MockEmptyConversation(string firstName, string middleName, string lastName, string phoneNumberValue)
        {
            PhoneNumber phoneNumber = new PhoneNumber(phoneNumberValue);

            AssociatedContacts = new ContactList();
            Contact contact = new MockContact(firstName, middleName, lastName, phoneNumber);

            AssociatedContacts.Add(contact);
        }
Exemplo n.º 3
0
        public MockEmptyConversation(string firstName, string middleName, string lastName, string phoneNumberValue)
        {
            PhoneNumber phoneNumber = new PhoneNumber(phoneNumberValue);

            AssociatedContacts = new ContactList();
            Contact contact = new MockContact(firstName, middleName, lastName, phoneNumber);

            AssociatedContacts.Add(contact);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public void DuplicateNumberChangedTypeTest()
        {
            IPhoneNumber duplicatedNumber     = new PhoneNumber("646-123-4567");
            IPhoneNumber duplicatedNumberCell = new PhoneNumber("646-123-4567");

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

            Assert.AreEqual(1, mergedContact.PhoneNumbers.Count);
        }
        public void AlphabeticalByContactTest()
        {
            string lowNumber = "111-111-1111";
            string midNumber = "555-555-5555";
            string highNumber = "999-999-9999";

            Contact contactA = new MockContact("Abraham", "Abramowitz", new PhoneNumber(lowNumber));
            Contact contactB = new MockContact("Ace", "Aarville", new PhoneNumber(midNumber));
            Contact contactC = new MockContact("Zed", "Ziffel", new PhoneNumber(highNumber));

            IConversation[] alphabeticallySortedConversations =
                {
                    new MockEmptyConversation("Aaron", null, null, lowNumber),
                    new MockEmptyConversation("Aaron", null, "Aaronsen", lowNumber),
                    new MockEmptyConversation("Aaron", "Abbot", "Aaronsen", lowNumber),
                    new MockEmptyConversation("Aaron", "Zukros", "Aaronsen", lowNumber),
                    new MockEmptyConversation("Aaron", null, "Zubitz", lowNumber),
                    new MockEmptyConversation("Aaron", "Abbot", "Zubitz", lowNumber),
                    new MockEmptyConversation("Aaron", "Zukros", "Zubitz", lowNumber),
                    new MockEmptyConversation("Aaron", "Zukros", "Zubitz", highNumber),
                    new MockEmptyConversation("Billy", null, null, lowNumber),
                    new MockEmptyConversation(null, null, "McCheese", lowNumber),
                    new MockEmptyConversation(null, null, "McCheese", highNumber),
                    new MockEmptyConversation(null, "Morgan", "Davies", highNumber),
                    new MockEmptyConversation(null, "Myxmaster", null, lowNumber),
                    new MockEmptyConversation(null, null, "Norrenson", lowNumber),
                    new MockEmptyConversation("Otter", null, null, lowNumber),
                    new MockEmptyConversation("Zippy", null, "Aaronsen", lowNumber),
                    new MockEmptyConversation("Zippy", "Abbot", "Aaronsen", lowNumber),
                    new MockEmptyConversation("Zippy", "Zukros", "Aaronsen", lowNumber),
                    new MockEmptyConversation("Zippy", null, "Zokowski", lowNumber),
                    new MockEmptyConversation("Zippy", "Zukros", "Zokowski", lowNumber),
                    new MockEmptyConversation("Zippy", "Zukros", "Zokowski", highNumber),
                    new MockEmptyConversation(lowNumber),
                    new MockEmptyConversation(highNumber),
                    new MockEmptyConversation(new IContact[] { contactA, contactB }),
                    new MockEmptyConversation(new IContact[] { contactA, contactB, contactC }),
                    new MockEmptyConversation(new IContact[] { contactA, contactC }),
                    new MockEmptyConversation(new IContact[] { contactB, contactC }),
                };

            VerifyOrderingMatches(alphabeticallySortedConversations, ConversationComparer.AlphabeticalByContact);
        }
        public void AlphabeticalByContactTest()
        {
            string lowNumber  = "111-111-1111";
            string midNumber  = "555-555-5555";
            string highNumber = "999-999-9999";

            Contact contactA = new MockContact("Abraham", "Abramowitz", new PhoneNumber(lowNumber));
            Contact contactB = new MockContact("Ace", "Aarville", new PhoneNumber(midNumber));
            Contact contactC = new MockContact("Zed", "Ziffel", new PhoneNumber(highNumber));

            IConversation[] alphabeticallySortedConversations =
            {
                new MockEmptyConversation("Aaron",     null,        null,        lowNumber),
                new MockEmptyConversation("Aaron",     null,        "Aaronsen",  lowNumber),
                new MockEmptyConversation("Aaron",     "Abbot",     "Aaronsen",  lowNumber),
                new MockEmptyConversation("Aaron",     "Zukros",    "Aaronsen",  lowNumber),
                new MockEmptyConversation("Aaron",     null,        "Zubitz",    lowNumber),
                new MockEmptyConversation("Aaron",     "Abbot",     "Zubitz",    lowNumber),
                new MockEmptyConversation("Aaron",     "Zukros",    "Zubitz",    lowNumber),
                new MockEmptyConversation("Aaron",     "Zukros",    "Zubitz",    highNumber),
                new MockEmptyConversation("Billy",     null,        null,        lowNumber),
                new MockEmptyConversation(null,        null,        "McCheese",  lowNumber),
                new MockEmptyConversation(null,        null,        "McCheese",  highNumber),
                new MockEmptyConversation(null,        "Morgan",    "Davies",    highNumber),
                new MockEmptyConversation(null,        "Myxmaster", null,        lowNumber),
                new MockEmptyConversation(null,        null,        "Norrenson", lowNumber),
                new MockEmptyConversation("Otter",     null,        null,        lowNumber),
                new MockEmptyConversation("Zippy",     null,        "Aaronsen",  lowNumber),
                new MockEmptyConversation("Zippy",     "Abbot",     "Aaronsen",  lowNumber),
                new MockEmptyConversation("Zippy",     "Zukros",    "Aaronsen",  lowNumber),
                new MockEmptyConversation("Zippy",     null,        "Zokowski",  lowNumber),
                new MockEmptyConversation("Zippy",     "Zukros",    "Zokowski",  lowNumber),
                new MockEmptyConversation("Zippy",     "Zukros",    "Zokowski",  highNumber),
                new MockEmptyConversation(lowNumber),
                new MockEmptyConversation(highNumber),
                new MockEmptyConversation(new IContact[] { contactA,contactB }),
                new MockEmptyConversation(new IContact[] { contactA,contactB,    contactC }),
                new MockEmptyConversation(new IContact[] { contactA,contactC }),
                new MockEmptyConversation(new IContact[] { contactB,contactC }),
            };

            VerifyOrderingMatches(alphabeticallySortedConversations, ConversationComparer.AlphabeticalByContact);
        }
Exemplo n.º 8
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));
        }