private void UserBasicInfo_Gender()
        {
            var oldValuesMerged = HttpUtility.HtmlDecode(ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.gender.ToString()));
            var oldValues       = ParsingHelper.StringToList(oldValuesMerged, ',');

            var newValues = new HashSet <string>();

            if (this.newData.Gender != null)
            {
                switch (newData.Gender)
                {
                case "Male":
                    newValues.Add("M");
                    break;

                case "Female":
                    newValues.Add("F");
                    break;

                default:
                    newValues.Add("unknown");
                    break;
                }
            }

            this.CompareAndLog_Test(
                EnumTestUnitNames.UserBasicInfo_Gender,
                "Comparing Gender",
                oldValues,
                newValues);
        }
Esempio n. 2
0
        private void UserPatientCareInfo_IsAcceptingNewPatients()
        {
            var oldValue = HttpUtility.HtmlDecode(ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.newPatients.ToString()));

            if (!string.IsNullOrEmpty(oldValue))
            {
                if (oldValue.ToUpper() == "NA")
                {
                    // See ticket #568
                    oldValue = "No";
                }
                else if (oldValue.ToUpper() == "ICO")
                {
                    // ticket #612 - InPatients Only - restricted yes
                    oldValue = "Yes";
                }

            }

            var newValue = string.Empty;

            if (this.newDataPatientCare != null && this.newDataPatientCare.AcceptingNewPatientsStatus != null)
            {
                newValue = this.newDataPatientCare.AcceptingNewPatientsStatus.Name;
            }

            this.CompareAndLog_Test(
                EnumTestUnitNames.UserPatientCareInfo_IsAcceptingNewPatients, 
                "Comparing Accepting New Patients", 
                oldValue,
                newValue);
        }
Esempio n. 3
0
        private void UserResearchCareInfo_Meshes()
        {
            var oldValuesMerged = HttpUtility.HtmlDecode(ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.mesh.ToString()));

            // data is originally in an HTML list
            oldValuesMerged = oldValuesMerged.Replace("</li><li>", ",");
            oldValuesMerged = oldValuesMerged.Replace("<ul><li>", "");
            oldValuesMerged = oldValuesMerged.Replace("</li></ul>", "");
            var oldValues = ParsingHelper.StringToList(oldValuesMerged, ',');

            var newValues = new HashSet <string>();

            if (newData != null && newData.Meshes != null && newData.Meshes.Count() > 0)
            {
                foreach (var entry in newData.Meshes)
                {
                    newValues.Add(entry.Keyword);
                }
            }

            this.CompareAndLog_Test(
                EnumTestUnitNames.UserResearchInfo_Meshes,
                "Comparing Research Meshes",
                oldValues,
                newValues);
        }
Esempio n. 4
0
        private void UserPatientCareInfo_ContainsData()
        {
            var oldValuePopulated = !string.IsNullOrWhiteSpace(ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.newPatients.ToString()));
            var oldValuePopulated2 = !string.IsNullOrWhiteSpace(ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.patientsGroups.ToString()));
            var oldValuePopulated3 = !string.IsNullOrWhiteSpace(ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.cancersTreated.ToString()));

            var oldPatientCarePopulated = oldValuePopulated || oldValuePopulated2 || oldValuePopulated3;

            var newPatientCarePopulated = (this.newDataPatientCare != null);

            this.CompareAndLog_Test(
                EnumTestUnitNames.UserPatientCareInfo_IsPopulated,
                "Comparing PatientCare data populated",
                oldPatientCarePopulated.ToString(),
                newPatientCarePopulated.ToString());
        }
        private void UserContactLocationInfo_UserAddress_IsMailing_Test(IEnumerable <XElement> oldServiceNodes, HashSet <string> newValues)
        {
            var watch = new Stopwatch();

            watch.Start();

            StringBuilder mailingAddress = new StringBuilder();

            mailingAddress.Append(ParsingHelper.ParseSingleValue(oldServiceNodes, EnumOldServiceFieldsAsKeys.mailingAddress1.ToString()));
            mailingAddress.Append(" ");
            mailingAddress.Append(ParsingHelper.ParseSingleValue(oldServiceNodes, EnumOldServiceFieldsAsKeys.mailingAddress2.ToString()));
            var oldValues = new HashSet <string>();

            oldValues.Add(mailingAddress.ToString());

            CompareAndLog_Test(EnumTestUnitNames.UserContactLocationInfo_Addresses_IsMailing, "Comparing Mailing Address", oldValues, newValues, watch);
        }
Esempio n. 6
0
        private void UserPatientCareInfo_IsSeeingPatientType()
        {
            var oldValuesMerged = HttpUtility.HtmlDecode(ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.patientsGroups.ToString()));
            var oldValues = ParsingHelper.StringToList(oldValuesMerged, ',');

            var newValues = new HashSet<string>();

            if (this.newDataPatientCare != null)
            {
                if (this.newDataPatientCare.IsSeeingAdults)
                {
                    newValues.Add("Adult");
                }
            }

            if (this.newDataPatientCare != null)
            {
                if (this.newDataPatientCare.IsSeeingChildren)
                {
                    newValues.Add("Child");
                }
            }

            if (this.newDataPatientCare != null)
            {
                if (this.newDataPatientCare.IsSeeingAdolescents)
                {
                    newValues.Add("Adolescent");
                }
            }

            if (this.newDataPatientCare != null)
            {
                if (this.newDataPatientCare.IsSeeingGeriatrics)
                {
                    newValues.Add("Geriatric");
                }
            }

            this.CompareAndLog_Test(
                EnumTestUnitNames.UserPatientCareInfo_IsSeeingPatientType, 
                "Comparing Patient Type(s)", 
                oldValues, 
                newValues);
        }
Esempio n. 7
0
        private void UserGeneralInfo_All_EduProfSuffixes()
        {
            string oldValuePart1 = ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.degree.ToString());
            string oldValuePart2 = ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.professionalSuffix.ToString());

            HashSet <string> oldValues = ParsingHelper.StringToList(oldValuePart1, ',');

            oldValues = ParsingHelper.StringToList(oldValuePart2, ',', oldValues);

            HashSet <string> oldValuesToExpectedNewValues = new HashSet <string>();

            foreach (var oldValue in oldValues)
            {
                // present old value as the value expected to be returned by the new service in order to pass the test: ticket #467
                var oldValueToExpectedNewValue = this.suffixMapping.Where(n => n.Key.ToUpper() == oldValue.Trim().ToUpper()).Select(n => n.Value);

                if (oldValueToExpectedNewValue != null && oldValueToExpectedNewValue.Count() > 0)
                {
                    oldValuesToExpectedNewValues.Add(oldValueToExpectedNewValue.First());
                }
                else
                {
                    // value not mapped
                    oldValuesToExpectedNewValues.Add(oldValue);
                }
            }

            HashSet <string> newValues = new HashSet <string>();

            try
            {
                if (newData.Titles.Count() > 0)
                {
                    foreach (var suffix in newData.Suffixes)
                    {
                        newValues.Add(HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(suffix.Name)));
                    }
                }
            }
            catch (Exception) { }

            this.CompareAndLog_Test(EnumTestUnitNames.UserGeneralInfo_All_EduProfSuffixes, "Comparing list of Suffix(es)", oldValuesToExpectedNewValues, newValues);
        }
Esempio n. 8
0
        private void UserEducationTrainingInfo_CancersTreated()
        {
            var oldValuesMerged = ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.cancersTreated.ToString());
            var oldValues = ParsingHelper.StringToList(oldValuesMerged, ',');

            var newValues = new HashSet<string>();
            if (this.newDataPatientCare != null && this.newDataPatientCare.CancersTreated != null)
            {
                foreach (var newValueEntry in this.newDataPatientCare.CancersTreated)
                {
                    if (!string.IsNullOrEmpty(newValueEntry.Name))
                    {
                        newValues.Add(HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newValueEntry.Name)));
                    }
                }
            }

            this.CompareAndLog_Test(EnumTestUnitNames.UserPatientCareInfo_CancersTreated, "Comparing Cancer(s) Treated", oldValues, newValues);
        }
        private void UserContactLocationInfo_UserAddress_StreetAddress_Test(IEnumerable <XElement> oldServiceNodes, HashSet <string> newValues)
        {
            var watch = new Stopwatch();

            watch.Start();

            HashSet <string> oldValues = ParsingHelper.ParseUnstructuredListOfValues(oldServiceNodes, EnumOldServiceFieldsAsKeys.addressLine1.ToString());

            StringBuilder mailingAddress = new StringBuilder();

            mailingAddress.Append(ParsingHelper.ParseSingleValue(oldServiceNodes, EnumOldServiceFieldsAsKeys.mailingAddress1.ToString()));
            mailingAddress.Append(" ");
            mailingAddress.Append(ParsingHelper.ParseSingleValue(oldServiceNodes, EnumOldServiceFieldsAsKeys.mailingAddress2.ToString()));

            if (!string.IsNullOrWhiteSpace(mailingAddress.ToString()))
            {
                oldValues.Add(mailingAddress.ToString());
            }

            CompareAndLog_Test(EnumTestUnitNames.UserContactLocationInfo_Addresses_StreetAddress, "Comparing Address StreetInfo(s)", oldValues, newValues, watch);
        }
Esempio n. 10
0
        public override void RunAllTests()
        {
            //init all loop variables
            string oldServiceURL;
            string oldServiceXMLOutput;

            string errorType    = string.Empty;
            string errorMessage = string.Empty;

            OldIdList = new DatabaseFacade().ConnectToDataSourceAndRetrieveOldIds("a30");

            var singleProfileWatch   = new Stopwatch();
            var testingDurationWatch = new Stopwatch();
            var oldServiceDataWatch  = new Stopwatch();
            var newServiceDataWatch  = new Stopwatch();

            testingDurationWatch.Start();

            LogManager.Instance.StartWritingReports();

            if (TestSuiteUser.IsDebugMode)
            {
                OldIdList = new HashSet <int>()
                {
                    12386392, 12789020, 10254830, 10345899, 10643722, 10356439, 13087115, 10098855, 10445859, 12445467, 10044421, 11842460, 10273683, 11228709, 12528002, 10410346, 10071485, 10934133, 12149599, 12641341, 10151776, 10290564, 11091604, 11472557, 12149599, 13132301, 10146455, 13157019, 10646102, 12192949, 10106216, 12268225, 11161032, 11832447, 11436806, 10736848
                };
            }

            bool keepGoing = true;

            //loop on the list of all OldIds retrieved from the old database
            foreach (int OldId in OldIdList)
            //Parallel.ForEach(OldIdList, OldId =>
            {
                if (keepGoing)
                {
                    oldServiceXMLOutput = string.Empty;

                    System.Diagnostics.Debug.WriteLine(OldId);
                    System.Console.Out.WriteLine(OldId);

                    LogManager.Instance.StatsCountTotalOldIds++;

                    if (false && LogManager.Instance.StatsCountTotalOldIds > 1000)
                    {
                        keepGoing = false;
                    }


                    singleProfileWatch.Start();

                    if (LogManager.Instance.StatsCountTotalOldIds % MaxProfilesForOneFile == 0)
                    {
                        // change to next output files
                        LogManager.Instance.StartWritingReports();
                    }

                    //go to the old service and retrieve the data
                    oldServiceURL = this.BuildOldServiceFullURL(OldId);

                    //Find a way to set the 'Timeout' property in Milliseconds. The old service can be slow.
                    //we also need exception handling!
                    oldServiceDataWatch.Start();
                    try
                    {
                        using (var webClient = new TimeoutExtendedWebClient())
                        {
                            try
                            {
                                webClient.Encoding  = System.Text.Encoding.UTF8;
                                oldServiceXMLOutput = webClient.DownloadString(oldServiceURL);
                            }
                            catch (WebException we)
                            {
                                System.Diagnostics.Debug.WriteLine(we.StackTrace);
                                System.Diagnostics.Debug.WriteLine("Trying to get data from old service for OldId " + OldId + " again");

                                try
                                {
                                    oldServiceXMLOutput = webClient.DownloadString(oldServiceURL);
                                }
                                catch (WebException we2)
                                {
                                    System.Diagnostics.Debug.WriteLine(we2.StackTrace);
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine(e.StackTrace);
                        System.Diagnostics.Debug.WriteLine("Some inactive profiles do not have the flag set in the old service. Likely to be the case here.");
                    }
                    oldServiceDataWatch.Stop();

                    var allTheTests   = new HashSet <TestUnit>();
                    var allTheResults = new HashSet <ResultReport>();

                    XDocument oldServiceXMLOutputDocument = null;
                    IEnumerable <XElement> oldData        = null;
                    UserBasicInfo          newDataBasic   = null;
                    UserCompleteInfo       newData        = null;
                    string pageName = string.Empty;
                    int    userId;

                    if (!string.IsNullOrEmpty(oldServiceXMLOutput))
                    {
                        try
                        {
                            oldServiceXMLOutputDocument = XDocument.Parse(oldServiceXMLOutput);
                            oldData = oldServiceXMLOutputDocument.XPathSelectElements("/Faculty/facultyMember/*");

                            var rootDepthOnly = ParsingHelper.ParseListNodesOnlySameDepth(oldData, null);
                            //}
                            //catch (Exception e)
                            //{
                            //    System.Diagnostics.Debug.WriteLine(e.StackTrace);
                            //}

                            //try
                            //{

                            bool isInactive = false;

                            // there is a third state : "Read-Only", not used for the moment
                            isInactive = (ParsingHelper.ParseSingleValue(oldData, "Inactive") == "Yes");

                            if (!isInactive)
                            {
                                TestUnit testUnit;
                                IEnumerable <XElement> oldDataSubset = null;
                                var usersClient = new UsersClient();

                                newServiceDataWatch.Start();

                                newDataBasic = usersClient.GetUserByOldId(OldId);

                                newServiceDataWatch.Stop();

                                userId   = newDataBasic.UserId;
                                pageName = newDataBasic.PageName;

                                // This service has to be called first because it will provided the User ID mapped to the OldId for the next calls.
                                oldDataSubset = rootDepthOnly;
                                testUnit      = new TestUnitUserBasicInfo(this, newDataBasic);
                                allTheTests.Add(testUnit);
                                testUnit.ProvideData(
                                    OldId,
                                    oldDataSubset,
                                    -1,
                                    pageName);
                                testUnit.RunAllTests();
                                oldDataSubset = null;

                                newServiceDataWatch.Start();

                                newData = usersClient.GetUserCompleteByPageName(pageName);

                                newServiceDataWatch.Stop();

                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.title.ToString(), new List <XElement>(rootDepthOnly));
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.cv.ToString(), new List <XElement>(oldDataSubset));
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.language.ToString(), new List <XElement>(oldDataSubset));
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.department.ToString(), new List <XElement>(oldDataSubset));
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.treeDepartments.ToString(), new List <XElement>(oldDataSubset));
                                testUnit      = new TestUnitUserGeneralInfo(this, newData);
                                allTheTests.Add(testUnit);
                                testUnit.ProvideData(
                                    OldId,
                                    oldDataSubset,
                                    userId,
                                    pageName);
                                testUnit.RunAllTests();
                                oldDataSubset = null;

                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.assistant.ToString());
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.labWebsite.ToString(), new List <XElement>(oldDataSubset));
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.location.ToString(), new List <XElement>(oldDataSubset));
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.mailing.ToString(), new List <XElement>(oldDataSubset), true);
                                testUnit      = new TestUnitUserContactLocationInfo(this, newData.LabWebsites, newData.UserAddresses);
                                allTheTests.Add(testUnit);
                                testUnit.ProvideData(
                                    OldId,
                                    oldDataSubset,
                                    userId,
                                    pageName);
                                testUnit.RunAllTests();
                                oldDataSubset = null;

                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.featuredPublication.ToString());
                                testUnit      = new TestUnitUserPublicationInfo(this, newData.UserPublications);
                                allTheTests.Add(testUnit);
                                testUnit.ProvideData(
                                    OldId,
                                    oldDataSubset,
                                    userId,
                                    pageName);
                                testUnit.RunAllTests();
                                oldDataSubset = null;

                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.researchSummary.ToString());
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.researchOverview.ToString(), new List <XElement>(oldDataSubset));
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.publicHealthKeywords.ToString(), new List <XElement>(oldDataSubset));
                                testUnit      = new TestUnitUserResearchInfo(this, newData.Research);
                                allTheTests.Add(testUnit);
                                testUnit.ProvideData(
                                    OldId,
                                    oldDataSubset,
                                    userId,
                                    pageName);
                                testUnit.RunAllTests();
                                oldDataSubset = null;

                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.education.ToString());
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.training.ToString(), new List <XElement>(oldDataSubset));
                                testUnit      = new TestUnitUserEducationTrainingInfo(this, newData.Educations, newData.Trainings);
                                allTheTests.Add(testUnit);
                                testUnit.ProvideData(
                                    OldId,
                                    oldDataSubset,
                                    userId,
                                    pageName);
                                testUnit.RunAllTests();
                                oldDataSubset = null;

                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.professionalHonor.ToString());
                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.professionalService.ToString(), new List <XElement>(oldDataSubset));
                                testUnit      = new TestUnitUserHonorServiceInfo(this, newData.Honors, newData.Services);
                                allTheTests.Add(testUnit);
                                testUnit.ProvideData(
                                    OldId,
                                    oldDataSubset,
                                    userId,
                                    pageName);
                                testUnit.RunAllTests();
                                oldDataSubset = null;

                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.boardCertification.ToString(), new List <XElement>(rootDepthOnly));
                                testUnit      = new TestUnitUserPatientCareInfo(this, newData.BoardCertifications, newData.PatientCare);
                                allTheTests.Add(testUnit);
                                testUnit.ProvideData(
                                    OldId,
                                    oldDataSubset,
                                    userId,
                                    pageName);
                                testUnit.RunAllTests();
                                oldDataSubset = null;

                                oldDataSubset = ParsingHelper.ParseListNodes(oldData, EnumOldServiceFieldsAsKeys.treeDepartments.ToString());
                                testUnit      = new TestUnitUserOrganization(this, newData.OrganizationsTree);
                                allTheTests.Add(testUnit);
                                testUnit.ProvideData(
                                    OldId,
                                    oldDataSubset,
                                    userId,
                                    pageName);
                                testUnit.RunAllTests();
                                oldDataSubset = null;

                                oldDataSubset = rootDepthOnly;
                                testUnit      = new TestUnitUserGeneralContact(this, newData.GeneralContact);
                                allTheTests.Add(testUnit);
                                testUnit.ProvideData(
                                    OldId,
                                    oldDataSubset,
                                    userId,
                                    pageName);
                                testUnit.RunAllTests();
                                oldDataSubset = null;

                                foreach (var test in allTheTests)
                                {
                                    test.ComputerOverallResults();
                                    allTheResults.UnionWith(test.DetailedResults.Values);

                                    // log only first occurence of error - enough to generate the warning
                                    if ((test.HttpErrorHappened || test.UnknownErrorHappened) && string.IsNullOrEmpty(errorMessage))
                                    {
                                        errorMessage = test.ErrorMessage;

                                        if (test.HttpErrorHappened)
                                        {
                                            errorType = "HTTP";
                                        }
                                        else
                                        {
                                            errorType = "UNKNOWN";
                                        }
                                    }
                                }
                            }
                            else
                            {
                                LogManager.Instance.StatsCountProfilesIgnored++;
                            }
                        }
                        catch (Exception e)
                        {
                            System.Console.WriteLine(e.StackTrace);
                            System.Diagnostics.Debug.WriteLine(e.StackTrace);
                            System.Console.WriteLine(e.InnerException);
                            System.Diagnostics.Debug.WriteLine(e.InnerException);
                        }
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("No data returned by old service for OldId " + OldId);
                        System.Console.Out.WriteLine("No data returned by old service for OldId " + OldId);
                    }

                    singleProfileWatch.Stop();

                    LogManager.Instance.LogProfileResult(OldId, allTheResults, singleProfileWatch.Elapsed, oldServiceDataWatch.Elapsed, newServiceDataWatch.Elapsed);

                    singleProfileWatch.Reset();
                    oldServiceDataWatch.Reset();
                    newServiceDataWatch.Reset();
                }
            }
            testingDurationWatch.Stop();

            LogManager.Instance.LogSummary(testingDurationWatch.Elapsed, errorType, errorMessage);

            LogManager.Instance.Dispose();
        }
        private void UserContactLocationInfo_Addresses_Test()
        {
            var watch = new Stopwatch();

            watch.Start();

            var oldValues = ParsingHelper.ParseStructuredListOfValues(this.OldDataNodes, EnumOldServiceFieldsAsKeys.location.ToString(), new EnumOldServiceFieldsAsKeys[] { EnumOldServiceFieldsAsKeys.locationName,
                                                                                                                                                                            EnumOldServiceFieldsAsKeys.building,
                                                                                                                                                                            EnumOldServiceFieldsAsKeys.addressLine1,
                                                                                                                                                                            EnumOldServiceFieldsAsKeys.suite,
                                                                                                                                                                            EnumOldServiceFieldsAsKeys.city,
                                                                                                                                                                            EnumOldServiceFieldsAsKeys.state,
                                                                                                                                                                            EnumOldServiceFieldsAsKeys.zipCode,
                                                                                                                                                                            EnumOldServiceFieldsAsKeys.type,
                                                                                                                                                                            EnumOldServiceFieldsAsKeys.displayOrder });

            // add mailing address manually
            if (this.OldDataNodes != null)
            {
                var mailingAddress = new Dictionary <EnumOldServiceFieldsAsKeys, string>();

                try
                {
                    mailingAddress.Add(EnumOldServiceFieldsAsKeys.locationName, ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.mailingAddressName.ToString()));
                }
                catch (Exception)
                {
                    // make sure a value is present for each index
                    mailingAddress.Add(EnumOldServiceFieldsAsKeys.locationName, string.Empty);
                }

                mailingAddress.Add(EnumOldServiceFieldsAsKeys.building, string.Empty);


                try
                {
                    StringBuilder value = new StringBuilder();
                    value.Append(ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.mailingAddress1.ToString()));
                    value.Append(" ");
                    value.Append(ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.mailingAddress2.ToString()));

                    mailingAddress.Add(EnumOldServiceFieldsAsKeys.addressLine1, value.ToString().Trim());
                }
                catch (Exception)
                {
                    // make sure a value is present for each index
                    mailingAddress.Add(EnumOldServiceFieldsAsKeys.addressLine1, string.Empty);
                }

                mailingAddress.Add(EnumOldServiceFieldsAsKeys.suite, string.Empty);


                try
                {
                    mailingAddress.Add(EnumOldServiceFieldsAsKeys.city, ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.mailingAddressCity.ToString()));
                }
                catch (Exception)
                {
                    // make sure a value is present for each index
                    mailingAddress.Add(EnumOldServiceFieldsAsKeys.city, string.Empty);
                }

                try
                {
                    mailingAddress.Add(EnumOldServiceFieldsAsKeys.state, ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.mailingAddressState.ToString()));
                }
                catch (Exception)
                {
                    // make sure a value is present for each index
                    mailingAddress.Add(EnumOldServiceFieldsAsKeys.state, string.Empty);
                }

                try
                {
                    mailingAddress.Add(EnumOldServiceFieldsAsKeys.zipCode, ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.mailingAddressZip.ToString()));
                }
                catch (Exception)
                {
                    // make sure a value is present for each index
                    mailingAddress.Add(EnumOldServiceFieldsAsKeys.zipCode, string.Empty);
                }

                bool atLeastOneFieldPopulated = mailingAddress.Where(x => !string.IsNullOrWhiteSpace(x.Value)).Count() > 0;

                if (atLeastOneFieldPopulated)
                {
                    oldValues.Add(mailingAddress);
                }
            }


            var newValues = new HashSet <Dictionary <EnumOldServiceFieldsAsKeys, string> >();

            Dictionary <EnumOldServiceFieldsAsKeys, string> properties;

            if (this.newDataUserAddress != null)
            {
                foreach (var newValue in this.newDataUserAddress)
                {
                    properties = new Dictionary <EnumOldServiceFieldsAsKeys, string>();

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.locationName, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newValue.Address.OfficeName)));
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.locationName, string.Empty);
                    }

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.building, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newValue.Address.Building.Name)));
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.building, string.Empty);
                    }

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.addressLine1, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newValue.Address.Building.StreetAddress)));
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.addressLine1, string.Empty);
                    }

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.suite, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newValue.Address.Suite)));
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.suite, string.Empty);
                    }

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.city, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newValue.Address.Building.Locality.City)));
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.city, string.Empty);
                    }

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.state, newValue.Address.Building.Locality.StateRegionProvince);
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.state, string.Empty);
                    }

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.zipCode, newValue.Address.Building.Locality.PostalCode);
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.zipCode, string.Empty);
                    }

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.type, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newValue.Address.AddressType.Name)));
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.type, string.Empty);
                    }

                    try
                    {
                        // #615 - sort order for locations should be matched in new service
                        properties.Add(EnumOldServiceFieldsAsKeys.displayOrder, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newValue.SortOrder.ToString())));
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.displayOrder, string.Empty);
                    }


                    newValues.Add(properties);
                }
            }

            this.CompareAndLog_Test(EnumTestUnitNames.UserContactLocationInfo_Addresses, "Comparing Address(es)", oldValues, newValues, watch);
        }