private void UserEducationTrainingInfo_Education()
        {
            var oldValues = ParsingHelper.ParseStructuredListOfValues(
                this.OldDataNodes,
                EnumOldServiceFieldsAsKeys.education.ToString(),
                new EnumOldServiceFieldsAsKeys[] { EnumOldServiceFieldsAsKeys.degree,
                                                   EnumOldServiceFieldsAsKeys.institution,
                                                   EnumOldServiceFieldsAsKeys.gradYear });

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

            Dictionary <EnumOldServiceFieldsAsKeys, string> properties;

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

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

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

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.gradYear, String.Format("{0:yyyy}", newValue.DateAwarded));
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.gradYear, string.Empty);
                    }

                    newValues.Add(properties);
                }
            }

            this.CompareAndLog_Test(EnumTestUnitNames.UserEducationTrainingInfo_Education, "Comparing Education(s)", oldValues, newValues);
        }
        private void UserEducationTrainingInfo_Trainings()
        {
            var oldValues = ParsingHelper.ParseStructuredListOfValues(
                this.OldDataNodes,
                EnumOldServiceFieldsAsKeys.training.ToString(), new
                EnumOldServiceFieldsAsKeys[] { EnumOldServiceFieldsAsKeys.departmentName,
                                               EnumOldServiceFieldsAsKeys.startYear,
                                               EnumOldServiceFieldsAsKeys.endYear,
                                               EnumOldServiceFieldsAsKeys.position,
                                               EnumOldServiceFieldsAsKeys.locationName });
            // TODO: Location belongs in a dedicated test
            var newValues = new HashSet <Dictionary <EnumOldServiceFieldsAsKeys, string> >();

            Dictionary <EnumOldServiceFieldsAsKeys, string> properties;

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

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

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.startYear, newValue.StartDate.ToString());
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.startYear, string.Empty);
                    }

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.endYear, newValue.EndDate.ToString());
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.endYear, string.Empty);
                    }

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

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

                    newValues.Add(properties);
                }
            }

            this.CompareAndLog_Test(EnumTestUnitNames.UserEducationTrainingInfo_Trainings, "Comparing Training(s)", oldValues, newValues);
        }
Пример #3
0
        private void UserEducationTrainingInfo_Honors()
        {
            //EnumOldServiceFieldsAsKeys.presentationDate,
            var oldValues = ParsingHelper.ParseStructuredListOfValues(this.OldDataNodes, EnumOldServiceFieldsAsKeys.professionalHonor.ToString(), new EnumOldServiceFieldsAsKeys[] { EnumOldServiceFieldsAsKeys.award,
                                                                                                                                                                                     EnumOldServiceFieldsAsKeys.organization,
                                                                                                                                                                                     EnumOldServiceFieldsAsKeys.presentationDate,
                                                                                                                                                                                     EnumOldServiceFieldsAsKeys.category });
            DatesRegExRewriter rewriter = new DatesRegExRewriter();
            List <string>      temp     = new List <string>();

            foreach (var oldValue in oldValues)
            {
                temp.Clear();
                if (oldValue[EnumOldServiceFieldsAsKeys.presentationDate] != null)
                {
                    temp.AddRange(rewriter.ConvertDate(HttpUtility.HtmlDecode(oldValue[EnumOldServiceFieldsAsKeys.presentationDate]), true));
                    oldValue[EnumOldServiceFieldsAsKeys.presentationDate] = String.Join(", ", temp.ToArray());;
                }
            }

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

            Dictionary <EnumOldServiceFieldsAsKeys, string> properties;

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

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

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

                    try
                    {
                        // list of honor dates has been turned into string for comparison - "{0:MM/dd/yy}"
                        properties.Add(EnumOldServiceFieldsAsKeys.presentationDate, String.Join(", ", newValue.HonorDates.Select(ss => string.Format("{0:01/01/yy}", DateTime.Parse(ss.ToString(), CultureInfo.CurrentCulture))).ToArray()));
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.presentationDate, string.Empty);
                    }

                    try
                    {
                        if (newValue.HonorCategory.Name == "Unknown")
                        {
                            // keep coherent with old service for testing
                            properties.Add(EnumOldServiceFieldsAsKeys.category, string.Empty);
                        }
                        else
                        {
                            properties.Add(EnumOldServiceFieldsAsKeys.category, newValue.HonorCategory.Name);
                        }
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.category, string.Empty);
                    }

                    newValues.Add(properties);
                }
            }

            this.CompareAndLog_Test(EnumTestUnitNames.UserHonorServiceInfo_Honors, "Comparing Honor(s)", oldValues, newValues);
        }
Пример #4
0
        /// <summary>
        /// This is an example where the data is compared as a structure.
        /// </summary>
        private void UserEducationTrainingInfo_Services()
        {
            var oldValues = ParsingHelper.ParseStructuredListOfValues(this.OldDataNodes, EnumOldServiceFieldsAsKeys.professionalService.ToString(), new EnumOldServiceFieldsAsKeys[] { EnumOldServiceFieldsAsKeys.role,
                                                                                                                                                                                       EnumOldServiceFieldsAsKeys.organization,
                                                                                                                                                                                       EnumOldServiceFieldsAsKeys.startDate,
                                                                                                                                                                                       EnumOldServiceFieldsAsKeys.endDate,
                                                                                                                                                                                       EnumOldServiceFieldsAsKeys.category,
                                                                                                                                                                                       EnumOldServiceFieldsAsKeys.description });

            foreach (var structure in oldValues)
            {
                // metadata is added for comparison with more complete new data
                //structure[EnumOldServiceFieldsAsKeys.role] = "Professional Organization";

                try
                {
                    structure[EnumOldServiceFieldsAsKeys.startDate] = string.Format("{0:yyyy}", DateTime.Parse(structure[EnumOldServiceFieldsAsKeys.startDate], CultureInfo.CurrentCulture));
                }
                catch (Exception)
                {
                    structure[EnumOldServiceFieldsAsKeys.startDate] = string.Empty;
                }

                try
                {
                    // not dates : present, now, curr, Present, on, psnt, 200, 0201, today, "04/??/19".
                    // YMPS-506 : endDate ongoing <=> null
                    structure[EnumOldServiceFieldsAsKeys.endDate] = string.Format("{0:yyyy}", DateTime.Parse(structure[EnumOldServiceFieldsAsKeys.endDate], CultureInfo.CurrentCulture));
                }
                catch (Exception)
                {
                    structure[EnumOldServiceFieldsAsKeys.endDate] = string.Empty;
                }
            }

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

            Dictionary <EnumOldServiceFieldsAsKeys, string> properties;

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

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

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

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.startDate, newValue.StartDate.ToString());
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.startDate, string.Empty);
                    }

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.endDate, newValue.EndDate.ToString());
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.endDate, string.Empty);
                    }

                    try
                    {
                        if (newValue.ServiceCategory.Name == "Unknown")
                        {
                            // keep coherent with old service for testing
                            properties.Add(EnumOldServiceFieldsAsKeys.category, string.Empty);
                        }
                        else
                        {
                            properties.Add(EnumOldServiceFieldsAsKeys.category, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newValue.ServiceCategory.Name)));
                        }
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.category, string.Empty);
                    }

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

                    newValues.Add(properties);
                }
            }

            this.CompareAndLog_Test(EnumTestUnitNames.UserHonorServiceInfo_Services, "Comparing Service(s)", oldValues, newValues);
        }
Пример #5
0
        private void UserEducationTrainingInfo_BoardCertifications()
        {
            var oldValues = ParsingHelper.ParseStructuredListOfValues(
                this.OldDataNodes, 
                EnumOldServiceFieldsAsKeys.boardCertification.ToString(), 
                new EnumOldServiceFieldsAsKeys[] { 
                    EnumOldServiceFieldsAsKeys.specialty,
                    EnumOldServiceFieldsAsKeys.organization,
                    EnumOldServiceFieldsAsKeys.certificationYear});

            foreach (var oldValue in oldValues)
            {
                if (oldValue[EnumOldServiceFieldsAsKeys.organization] != null && oldValue[EnumOldServiceFieldsAsKeys.organization].ToLower().Trim() == "none")
                {
                    oldValue[EnumOldServiceFieldsAsKeys.organization] = string.Empty;
                }
            }

            // TODO: Location belongs in a dedicated test
            var newValues = new HashSet<Dictionary<EnumOldServiceFieldsAsKeys, string>>();

            Dictionary<EnumOldServiceFieldsAsKeys, string> properties;

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

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

                    try
                    {
                        if (!newValue.CertificationOrganization.ToLower().Contains("none"))
                        {
                            properties.Add(EnumOldServiceFieldsAsKeys.organization, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newValue.CertificationOrganization)));
                        }
                        else
                        {
                            properties.Add(EnumOldServiceFieldsAsKeys.organization, string.Empty);
                        }
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.organization, string.Empty);
                    }

                    try
                    {
                        properties.Add(EnumOldServiceFieldsAsKeys.certificationYear, String.Format("{0:yyyy}", newValue.OriginalDate));
                    }
                    catch (Exception)
                    {
                        // make sure a value is present for each index
                        properties.Add(EnumOldServiceFieldsAsKeys.certificationYear, string.Empty);
                    }

                    newValues.Add(properties);
                }
            }

            this.CompareAndLog_Test(EnumTestUnitNames.UserPatientCareInfo_BoardCertifications, "Comparing Board Certification(s)", oldValues, newValues);
        }
        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);
        }