private void UserContactLocationInfo_Addresses_Geo(IEnumerable <XElement> oldServiceNodes, HashSet <GeoPoint> newValues)
        {
            var watch = new Stopwatch();

            watch.Start();

            List <string> oldValues = new List <string>();

            oldValues.AddRange(ParsingHelper.ParseUnstructuredListOfValues(oldServiceNodes, EnumOldServiceFieldsAsKeys.location.ToString(), EnumOldServiceFieldsAsKeys.latitude.ToString()));
            oldValues.AddRange(ParsingHelper.ParseUnstructuredListOfValues(oldServiceNodes, EnumOldServiceFieldsAsKeys.location.ToString(), EnumOldServiceFieldsAsKeys.longitude.ToString()));

            HashSet <string> roundedOldValues = new HashSet <string>(oldValues.Where(x => !string.IsNullOrEmpty(x)).Select(x => Math.Round(Double.Parse(x), 0).ToString()));

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

            if (newValues != null)
            {
                foreach (var value in newValues)
                {
                    try
                    {
                        roundedNewValues.Add(Math.Round((double)value.Latitude, 0).ToString());
                    }
                    catch (Exception) { }

                    try
                    {
                        roundedNewValues.Add(Math.Round((double)value.Longitude, 0).ToString());
                    }
                    catch (Exception) { }
                }
            }

            CompareAndLog_Test(EnumTestUnitNames.UserContactLocationInfo_Addresses_Geo, "Comparing Geo Location Data", roundedOldValues, roundedNewValues, watch);
        }
        private void UserContactLocationInfo_UserAddress_ZipCodes_Test(IEnumerable <XElement> oldServiceNodes, HashSet <string> newValues)
        {
            var watch = new Stopwatch();

            watch.Start();

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

            CompareAndLog_Test(EnumTestUnitNames.UserContactLocationInfo_Addresses_ZipCodes, "Comparing Address Zip Code(s)", oldValues, newValues, watch);
        }
Exemplo n.º 3
0
        private void UserGeneralInfo_CountCVs_Test()
        {
            HashSet <string> oldValues = ParsingHelper.ParseUnstructuredListOfValues(this.OldDataNodes, EnumOldServiceFieldsAsKeys.cv.ToString(), EnumOldServiceFieldsAsKeys.fileName.ToString());
            string           oldValue  = oldValues.Count().ToString();

            string newValue = string.Empty;

            try
            {
                newValue = (!string.IsNullOrEmpty(newData.CvUrl)?"1":"0");
            }
            catch (Exception) { }

            this.CompareAndLog_Test(EnumTestUnitNames.UserGeneralInfo_CVs_Count, "Count CVs listed", oldValue, newValue);
        }
Exemplo n.º 4
0
        private void UserGeneralInfo_LanguageUsers_Test()
        {
            var oldValues = ParsingHelper.ParseUnstructuredListOfValues(this.OldDataNodes, EnumOldServiceFieldsAsKeys.language.ToString(), EnumOldServiceFieldsAsKeys.languageName.ToString());
            var newValues = new HashSet <string>();

            try
            {
                if (newData.UserLanguages.Count() > 0)
                {
                    foreach (var language in newData.UserLanguages)
                    {
                        newValues.Add(HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(language.Language.Name)));
                    }
                }
            }
            catch (Exception) { }

            this.CompareAndLog_Test(EnumTestUnitNames.UserGeneralInfo_Languages, "Comparing LanguageUser(s)", oldValues, newValues);
        }
Exemplo n.º 5
0
        private void UserResearchInfo_PublicHealthKeywords()
        {
            HashSet <string> newValues = new HashSet <string>();;

            try
            {
                if (this.newData != null && this.newData.PublicHealths != null)
                {
                    newValues = new HashSet <string>(newData.PublicHealths.Where(x => x != null).Select(x => HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(x.Keyword))));
                }
            }
            catch (Exception) { }

            this.CompareAndLog_Test(
                EnumTestUnitNames.UserResearchInfo_PublicHealthKeywords,
                "Comparing Public Health Keyword(s)",
                ParsingHelper.ParseUnstructuredListOfValues(ParsingHelper.ParseListNodes(this.OldDataNodes, EnumOldServiceFieldsAsKeys.publicHealthKeywords.ToString()), EnumOldServiceFieldsAsKeys.keyword.ToString(), EnumOldServiceFieldsAsKeys.name.ToString()),
                newValues);
        }
Exemplo n.º 6
0
        private void UserPublicationInfo_Description()
        {
            var newValues = new HashSet <string>();

            try
            {
                if (this.newData != null)
                {
                    newValues = new HashSet <string>(this.newData.Where(x => x != null).Select(x => HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(x.Publication.Citation))));
                }
            }
            catch (Exception) { }

            this.CompareAndLog_Test(
                EnumTestUnitNames.UserPublicationInfo_Citations,
                "Comparing Publication Citation(s)",
                ParsingHelper.ParseUnstructuredListOfValues(this.OldDataNodes, EnumOldServiceFieldsAsKeys.featuredPublication.ToString(), EnumOldServiceFieldsAsKeys.description.ToString()),
                newValues);
        }
Exemplo n.º 7
0
        private HashSet <string> UserPublicationInfo_Titles()
        {
            HashSet <string> newValues;

            if (this.newData != null)
            {
                newValues = new HashSet <string>(newData.Where(x => x != null).Select(x => HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(x.Publication.Title))));
            }
            else
            {
                newValues = new HashSet <string>();
            }
            this.CompareAndLog_Test(
                EnumTestUnitNames.UserPublicationInfo_Titles,
                "Comparing Publication Title(s)",
                ParsingHelper.ParseUnstructuredListOfValues(this.OldDataNodes, EnumOldServiceFieldsAsKeys.featuredPublication.ToString(), EnumOldServiceFieldsAsKeys.titleName.ToString()),
                newValues);
            return(newValues);
        }
Exemplo n.º 8
0
        private void UserGeneralInfo_CheckUserProfileImageLink_Test()
        {
            HashSet <string> oldValues = ParsingHelper.ParseUnstructuredListOfValues(this.OldDataNodes, EnumOldServiceFieldsAsKeys.photoURL.ToString());
            string           oldValue  = oldValues.Count().ToString();

            string newValue = string.Empty;

            if (newData.ProfileImage != null && !string.IsNullOrEmpty(newData.ProfileImage.Url))
            {
                HttpWebResponse response = null;
                var             request  = (HttpWebRequest)WebRequest.Create(newData.ProfileImage.Url);
                request.Method = "HEAD";

                try
                {
                    response = (HttpWebResponse)request.GetResponse();
                    oldValue = "Exists";
                    newValue = "Exists";
                }
                catch (WebException ex)
                {
                    /* A WebException will be thrown if the status of the response is not `200 OK` */
                    oldValue = "FailedRetrieve";
                    newValue = "Exists";
                }
                finally
                {
                    // Don't forget to close your response.
                    if (response != null)
                    {
                        response.Close();
                    }
                }
            }
            else
            {
                oldValue = "None";
                newValue = "None";
            }

            this.CompareAndLog_Test(EnumTestUnitNames.UserGeneralInfo_ProfileImage_Link, "Check File Exists at Profile Image URL", oldValue, newValue);
        }
        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);
        }
Exemplo n.º 10
0
        //private void UserGeneralInfo_AltFirstName_Test()
        //{
        //    var watch = new Stopwatch();
        //    watch.Start();
        //    var resultReport = new ResultReport(this.UserId, this.OldId, EnumTestUnitNames.UserGeneralInfo_AltFirstName, "Comparing AltFirstName (if needed)");

        //    string oldValue = ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.firstname.ToString());
        //    var compareStrategy = new CompareStrategyFactory(oldValue, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newData.FirstName)), resultReport);
        //    compareStrategy.Investigate();

        //    if (resultReport.Severity != EnumResultSeverityType.SUCCESS)
        //    {
        //        resultReport = new ResultReport(this.UserId, this.OldId, EnumTestUnitNames.UserGeneralInfo_AltFirstName, "Comparing AltFirstName (if needed)");

        //        oldValue = ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.firstname.ToString());
        //        compareStrategy = new CompareStrategyFactory(oldValue, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newData.AltFirstName)), resultReport);
        //        compareStrategy.Investigate();
        //    }

        //    watch.Stop();
        //    resultReport.Duration = watch.Elapsed;

        //    this.DetailedResults.Add(resultReport.TestName, resultReport);

        //    LogManager.Instance.LogTestResult(this.Container.BuildOldServiceFullURL(this.OldId),
        //                                      this.BuildNewServiceURL(this.PageName),
        //                                      resultReport);
        //}

        //private void UserGeneralInfo_AltSuffixName_Test()
        //{
        //    var watch = new Stopwatch();
        //    watch.Start();
        //    var resultReport = new ResultReport(this.UserId, this.OldId, EnumTestUnitNames.UserGeneralInfo_AltSuffixName, "Comparing Alt SuffixName (if needed)");

        //    string oldValue = ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.suffix.ToString());

        //    // 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)
        //    {
        //        oldValue = oldValueToExpectedNewValue.First();
        //    }

        //    var compareStrategy = new CompareStrategyFactory(oldValue, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newData.Suffix)), resultReport);
        //    compareStrategy.Investigate();

        //    if (resultReport.Severity != EnumResultSeverityType.SUCCESS)
        //    {
        //        resultReport = new ResultReport(this.UserId, this.OldId, EnumTestUnitNames.UserGeneralInfo_AltSuffixName, "Comparing Alt SuffixName (if needed)");

        //        oldValue = ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.suffix.ToString());

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

        //        if (oldValueToExpectedNewValue != null && oldValueToExpectedNewValue.Count() > 0)
        //        {
        //            oldValue = oldValueToExpectedNewValue.First();
        //        }

        //        compareStrategy = new CompareStrategyFactory(oldValue, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newData.AltSuffix)), resultReport);
        //        compareStrategy.Investigate();
        //    }

        //    watch.Stop();
        //    resultReport.Duration = watch.Elapsed;

        //    this.DetailedResults.Add(resultReport.TestName, resultReport);

        //    LogManager.Instance.LogTestResult(this.Container.BuildOldServiceFullURL(this.OldId),
        //                                      this.BuildNewServiceURL(this.PageName),
        //                                      resultReport);
        //}

        //private void UserGeneralInfo_AltMiddleName_Test()
        //{
        //    var watch = new Stopwatch();
        //    watch.Start();
        //    var resultReport = new ResultReport(this.UserId, this.OldId, EnumTestUnitNames.UserGeneralInfo_AltMiddleName, "Comparing AltMiddleName (if needed)");

        //    string oldValue = ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.middle.ToString());
        //    if (string.IsNullOrEmpty(oldValue))
        //    {
        //        oldValue = "False";
        //    }
        //    var compareStrategy = new CompareStrategyFactory(oldValue, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newData.MiddleName)), resultReport);
        //    compareStrategy.Investigate();

        //    if (resultReport.Severity != EnumResultSeverityType.SUCCESS)
        //    {
        //        resultReport = new ResultReport(this.UserId, this.OldId, EnumTestUnitNames.UserGeneralInfo_AltMiddleName, "Comparing AltMiddleName (if needed)");

        //        oldValue = ParsingHelper.ParseSingleValue(this.OldDataNodes, EnumOldServiceFieldsAsKeys.middle.ToString());
        //        compareStrategy = new CompareStrategyFactory(oldValue, HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newData.AltMiddleName)), resultReport);
        //        compareStrategy.Investigate();
        //    }

        //    watch.Stop();
        //    resultReport.Duration = watch.Elapsed;

        //    this.DetailedResults.Add(resultReport.TestName, resultReport);

        //    LogManager.Instance.LogTestResult(this.Container.BuildOldServiceFullURL(this.OldId),
        //                                      this.BuildNewServiceURL(this.PageName),
        //                                      resultReport);
        //}

        private void UserGeneralInfo_Titles_Test()
        {
            HashSet <string> oldValues = ParsingHelper.ParseUnstructuredListOfValues(this.OldDataNodes, EnumOldServiceFieldsAsKeys.title.ToString(), EnumOldServiceFieldsAsKeys.titleName.ToString());

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

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

            this.CompareAndLog_Test(EnumTestUnitNames.UserGeneralInfo_Titles, "Comparing Title(s)", oldValues, newValues);
        }
        private void UserContactLocationInfo_UserAddress_Phones_Test(IEnumerable <XElement> oldServiceNodes, IEnumerable <UserAddress> newServiceNodes)
        {
            // phone numbers are specific to a UserAddress which is the equivalent of the Location in the old service
            // the locationName became the OfficeName
            var watch = new Stopwatch();

            watch.Start();

            var oldValues = new List <string>();

            oldValues.AddRange(ParsingHelper.ParseUnstructuredListOfValues(oldServiceNodes, EnumOldServiceFieldsAsKeys.location.ToString(), EnumOldServiceFieldsAsKeys.phoneNumber.ToString()));
            oldValues.AddRange(ParsingHelper.ParseUnstructuredListOfValues(oldServiceNodes, EnumOldServiceFieldsAsKeys.location.ToString(), EnumOldServiceFieldsAsKeys.phone2Number.ToString()));

            var newValues = new List <string>();
            var allPhones = newServiceNodes.Select(x => x.Phones);

            foreach (var list in allPhones)
            {
                newValues.AddRange(list.Select(x => ParsingHelper.FormatPhoneNumber(x.Number)));
            }

            CompareAndLog_Test(EnumTestUnitNames.UserContactLocationInfo_Addresses_Phones, "Comparing Address Phone Number(s)", new HashSet <string>(oldValues.Where(x => !string.IsNullOrWhiteSpace(x))), new HashSet <string>(newValues), watch);
        }