Ejemplo n.º 1
0
        public void Merge_NonUniqueContacts_ReturnsValue()
        {
            // arrange
            string[] contacts = { "andrei [email protected] +12345", "paraschiva [email protected] +23456", "aurel [email protected] +12345" };
            MergeContacts m = new MergeContacts();

            // act
            List<List<int>> actual = m.Merge(contacts);

            // assert
            Assert.AreEqual(actual.Count, 1);
            Assert.IsNotNull(actual[0].Single(c => c == 0));
            Assert.IsNotNull(actual[0].Single(c => c == 1));
            Assert.IsNotNull(actual[0].Single(c => c == 2));
        }
Ejemplo n.º 2
0
        public void Merge_DistinctContacts_ReturnsValue()
        {
            // arrange
            string[] contacts = { "andrei [email protected] +12345", "paraschiva [email protected] +23456", "aurel [email protected] +23423" };
            MergeContacts m = new MergeContacts();

            // act
            List<List<int>> actual = m.Merge(contacts);

            // assert
            Assert.AreEqual(actual.Count, 3);
            Assert.IsNotNull(actual.Single(c => c.Count == 1 && c[0] == 0));
            Assert.IsNotNull(actual.Single(c => c.Count == 1 && c[0] == 1));
            Assert.IsNotNull(actual.Single(c => c.Count == 1 && c[0] == 2));
        }
Ejemplo n.º 3
0
        public void Merge_NonUniqueAndUniqueContacts_ReturnsValue()
        {
            // arrange
            string[] contacts = { "andrei [email protected] +12345", "paraschiva [email protected] +23456", "aurel [email protected] +12345",
                                   "mihai [email protected] +53231", "petre [email protected] +32423"};
            MergeContacts m = new MergeContacts();

            // act
            List<List<int>> actual = m.Merge(contacts);

            // assert
            Assert.AreEqual(3, actual.Count);
            Assert.IsNotNull(actual.Single(a => a.Count == 3 &&
                a.Count(c => c == 0) == 1 && a.Count(c => c == 1) == 1 &&
                a.Count(c => c == 2) == 1));
            Assert.IsNotNull(actual.Single(c => c.Count == 1 && c[0] == 3));
            Assert.IsNotNull(actual.Single(c => c.Count == 1 && c[0] == 4));
        }