Ejemplo n.º 1
0
        public void ThenIVerifyBelowDataInTheRespectiveFieldsForTagInTheXMLFile_(string TagName, Table table)
        {
            XmlDocument           xDoc = (XmlDocument)ScenarioContext.Current["LoadedXML"];
            IEnumerable <XMLData> Data = table.CreateSet <XMLData>();
            List <XMLData>        List = (List <XMLData>)Data;

            if (!XMLActionUtilities.VerifyFieldDataInXMLTag(xDoc, TagName, List))
            {
                ScenarioContext.Current["Comments"]  = ScenarioContext.Current["Comments"] + "Failed to verify fields in the " + TagName + "' tag in the XML file. \n";
                ScenarioContext.Current["ActResult"] = "Failed";
            }
        }
Ejemplo n.º 2
0
        public void ThenIVerifyTheInIsAgainstDBByExecuting(string FieldName, string TagName, string DataValue, string Query)
        {
            SQLInfo Info = DataBase.DatabaseSteps.StoreSQLInfo();

            try
            {
                if (DatabaseUtilities.ConnectToDB(Info))
                {
                    Info.QueryResultTable = DatabaseUtilities.GetRecordsFromDB(Query, Info);
                    if (Info.QueryResultTable == null)
                    {
                        ScenarioContext.Current["Comments"]  = ScenarioContext.Current["Comments"] + "Unable to execute query " + Query + " on database. \n";
                        ScenarioContext.Current["ActResult"] = "Failed";
                    }
                    else
                    {
                        DataTable   data     = Info.QueryResultTable;
                        string      FilePath = FeatureContext.Current["ReportsFolderPath"].ToString();
                        string      content  = data.Rows[0].ItemArray[0].ToString();
                        XmlDocument xDoc     = (XmlDocument)ScenarioContext.Current["LoadedXML"];
                        if (!XMLActionUtilities.VerifyFieldDataInXMLTag(xDoc, TagName, FieldName, DataValue))
                        {
                            ScenarioContext.Current["Comments"]  = ScenarioContext.Current["Comments"] + FieldName + " value in " + TagName + " is displayed as " + content + " instead of " + DataValue + ". \n";
                            ScenarioContext.Current["ActResult"] = "Failed";
                        }
                    }
                    DatabaseUtilities.CloseDBConnection(Info);
                }
                else
                {
                    ScenarioContext.Current["Comments"]  = ScenarioContext.Current["Comments"] + "Unable to connect to database. \n";
                    ScenarioContext.Current["ActResult"] = "Failed";
                }
            }
            catch (Exception e)
            {
                string abc = Info.DataBaseName;
            }
        }