Ejemplo n.º 1
0
        public void VerifyEligibleActivities()
        {
            int             length;
            string          ClientName             = GlobalVariables.clientname.ToLower();
            List <string[]> eligibleactivitiesdata = CSVReaderDataTable.GetCSVData("EligibleActivitiesData", pageName, "newmembereligibleactivities", ClientName);

            string[]        actions = { "Url", "ButtonText" };
            object[]        matrix  = { "Title", "Description", "Points", "IncentiveSymbol", "FrequencyCount", "FrequencyDenomination", "LockedForGateKeeper", "GateKeeperText", "CanEarnText", "Actions", actions };
            List <string[]> result  = ApiKeywords.ParseEligibleActivitiesResponse(jsonresponse, matrix);

            Console.WriteLine("Result Count : " + result.Count);
            Console.WriteLine("Eligible Activites Count : " + eligibleactivitiesdata.Count);
            for (int i = 0; i < result.Count; i++)
            {
                foreach (string s in result.ElementAt(i))
                {
                    Console.Write("Value : " + s + "\t");
                }
                Console.WriteLine();
            }

            if (result.Count() != 0 && eligibleactivitiesdata.Count() != 0)
            {
                if (eligibleactivitiesdata.Count() < result.Count())
                {
                    length = eligibleactivitiesdata.Count();
                }
                else
                {
                    length = result.Count();
                }
                for (int i = 0; i < length; i++)
                {
                    int    expstartindex = 4;
                    string elementname   = eligibleactivitiesdata.ElementAt(i)[3];
                    for (int j = 0; j < result.ElementAt(i).Count(); j++)
                    {
                        string expectedtext = eligibleactivitiesdata.ElementAt(i)[expstartindex];
                        string actualtext   = result.ElementAt(i)[j];
                        expstartindex++;
                        Console.WriteLine("Element Name : " + elementname + "\tExpectedText : " + expectedtext + "\tActualText : " + actualtext);
                        softAssertions.Add(elementname, expectedtext, actualtext, "contains");
                        //if (journeydata.Count() < result.Count())
                        //    softAssertions.Add(elementname, "", actualtext, "not equals");
                        //else
                        //    softAssertions.Add(elementname, expectedtext, "", "not equals");
                    }
                }
            }
            else
            {
                softAssertions.Add("Activities count doesn't match", eligibleactivitiesdata.Count(), result.Count(), "equals");
            }
        }