예제 #1
0
 public string[] GetCoverageLimitsFormatUsedInIndicationFile()
 {
     string[] coverageLimits = Array.Empty <string>();
     string[] coverageLabels = CoveragesLabel.Where(x => x.Text != "Total Premium").Select(x => x.Text).ToArray();
     foreach (var item in coverageLabels)
     {
         var coverage = typeof(CoveragesType).GetFields()
                        .Where(x => item.Contains(x.GetValue(null).ToString()))
                        .Select(x => x.GetValue(null).ToString())
                        .FirstOrDefault();
         if (coverage != null)
         {
             string limitType     = item.Replace(coverage, "").Trim();
             string limit         = GetText(_lblCoverageLimit(item), 3);
             string coverageLimit = $"{CoveragesType.GetFullName(coverage)} {limit} {limitType}".Replace("  ", " ").Trim();
             coverageLimits = coverageLimits.Concat(new string[] { coverageLimit }).ToArray();
         }
         else
         {
             throw new Exception($"'{item}' does not match any CoveragesType");
         }
     }
     GetLastNode().Info(string.Join(" - ", coverageLimits));
     return(coverageLimits);
 }
예제 #2
0
        public SummaryPage ValidatePremiumInLeftNavigationMatchesSummaryScreen()
        {
            var node = GetLastNode();

            List <KeyValuePair <string, string[]> > comparisons = new List <KeyValuePair <string, string[]> >();

            try
            {
                foreach (var item in CoveragesLabel)
                {
                    string coverageType = item.Text;
                    if (coverageType == "Total Premium")
                    {
                        comparisons.Add(new KeyValuePair <string, string[]>(coverageType, new string[] { GetTextFromPageSource(_lblNavTotal), GetText(_lblCoveragePremium(coverageType)) }));
                    }
                    else
                    {
                        // Get coverage name that is used in left navigation
                        string navCoverageName = CoveragesType.GetShortName(coverageType);
                        if (navCoverageName == coverageType)
                        {
                            navCoverageName = AdditionalCoveragesType.GetShortName(coverageType);
                        }
                        comparisons.Add(new KeyValuePair <string, string[]>(coverageType + " Premium", new string[] { GetTextFromPageSource(_lblNavPremium(navCoverageName)), GetText(_lblCoveragePremium(coverageType)) }));
                    }
                }

                foreach (var item in comparisons)
                {
                    if (item.Value[0] == item.Value[1])
                    {
                        SetPassValidation(node, ValidationMessage.ValidatePremiumInLeftNavigationMatchesSummaryScreen, item.Key, item.Value[1]);
                    }
                    else
                    {
                        SetFailValidation(node, ValidationMessage.ValidatePremiumInLeftNavigationMatchesSummaryScreen, item.Key, item.Value[1], item.Value[0]);
                    }
                }
            }
            catch (Exception e)
            {
                SetErrorValidation(node, ValidationMessage.ValidatePremiumInLeftNavigationMatchesSummaryScreen, e);
            }

            return(this);
        }