Exemple #1
0
        public void Test_Merged_ContactPoint_Collection_Properties()
        {
            var p1 = ExternalPractitionerTests.TestHelper.CreatePractitioner("A", "1");

            var cp1 = TestHelper.AddContactPoint(p1, "cp1", "cp1");
            var a1  = TestHelper.AddAddress(cp1, "Toronto", "ON");
            var t1  = TestHelper.AddTelephoneNumber(cp1, "416", "1111111");
            var e1  = TestHelper.AddEmailAddress(cp1, "*****@*****.**");

            var cp2 = TestHelper.AddContactPoint(p1, "cp2", "cp2");
            var a2  = TestHelper.AddAddress(cp2, "Mississauga", "ON");
            var t2  = TestHelper.AddTelephoneNumber(cp1, "905", "2222222");
            var e2  = TestHelper.AddEmailAddress(cp1, "*****@*****.**");

            // perform the merge, and get reference to all collections under result
            var result    = TestHelper.SimpleMerge(cp1, cp2);
            var result_a1 = CollectionUtils.SelectFirst(result.Addresses, a => a.IsSameAddress(a1));
            var result_a2 = CollectionUtils.SelectFirst(result.Addresses, a => a.IsSameAddress(a2));
            var result_t1 = CollectionUtils.SelectFirst(result.TelephoneNumbers, t => t.IsSameNumber(t1));
            var result_t2 = CollectionUtils.SelectFirst(result.TelephoneNumbers, t => t.IsSameNumber(t2));
            var result_e1 = CollectionUtils.SelectFirst(result.EmailAddresses, e => e.IsSameEmailAddress(e1));
            var result_e2 = CollectionUtils.SelectFirst(result.EmailAddresses, e => e.IsSameEmailAddress(e2));

            // Verifying all the collection exists
            Assert.AreEqual(result.Addresses.Count, 2);
            Assert.AreEqual(result.TelephoneNumbers.Count, 2);
            Assert.AreEqual(result.EmailAddresses.Count, 2);
            Assert.IsNotNull(result_a1);
            Assert.IsNotNull(result_a2);
            Assert.IsNotNull(result_t1);
            Assert.IsNotNull(result_t2);
            Assert.IsNotNull(result_e1);
            Assert.IsNotNull(result_e2);
        }