public void trackChallenge(List <string[]> historyheader, List <string[]> historydata)
        {
            Common com = new Common();

            com.ClickChallengesMenu();
            if (GlobalVariables.clientname.ToLower().Equals("meabt"))
            {
                SeleniumKeywords.Click(pageName, "submenuchallenges");
            }
            ClickOnInProgressChallenge("The Mindful Bite");
            CommonTracker ct                  = new CommonTracker();
            DateTime      currentdate         = DateTime.Today;
            string        calenderdefaultdate = SeleniumKeywords.GetAttributeValue("Common", "calenderdatepicker", "value");
            string        currentdt           = String.Format("{0:MM/dd/yyyy}", currentdate);

            softAssertion.Add("Date Picker", currentdt, calenderdefaultdate, "equal");
            ClickOnYesBtn();
            JavaScriptKeywords.SetTextByControlId("DataPointDate", com.GetDate()[2]);
            ClickOnUpdateBtn();
            ct.ClickViewHistory();
            ValidateHistoryHeader(historyheader);
            // Step 2: Verify History data
            historydata.ElementAt(0)[4] = Convert.ToDateTime(com.GetDate()[2]).ToString("dddd, MMM dd yyyy");
            ValidateHistoryData(historydata);
        }
        /// <summary>
        ///     Asynchronously saves all changes made in this context to the underlying database.
        ///     If the tracker for an entity is active, it will also put the old values in tracking table.
        /// </summary>
        /// <param name="userName">Username of the logged in identity</param>
        /// <param name="cancellationToken">
        ///     A System.Threading.CancellationToken to observe while waiting for the task
        ///     to complete.
        /// </param>
        /// <returns>Returns the number of objects written to the underlying database.</returns>
        public virtual async Task <int> SaveChangesAsync(object userName, CancellationToken cancellationToken)
        {
            if (!GlobalTrackingConfig.Enabled)
            {
                return(await base.SaveChangesAsync(cancellationToken));
            }

            if (cancellationToken.IsCancellationRequested)
            {
                cancellationToken.ThrowIfCancellationRequested();
            }

            CommonTracker.AuditChanges(this, userName);

            IEnumerable <DbEntityEntry> addedEntries = CommonTracker.GetAdditions(this);

            // Call the original SaveChanges(), which will save both the changes made and the audit records...Note that added entry auditing is still remaining.
            int result = await base.SaveChangesAsync(cancellationToken);

            //By now., we have got the primary keys of added entries of added entiries because of the call to savechanges.
            CommonTracker.AuditAdditions(this, userName, addedEntries);

            //save changes to audit of added entries
            await base.SaveChangesAsync(cancellationToken);

            return(result);
        }
        private void InputAndUpdateNonBlendedTrackerData()
        {
            List <string[]> trackerdata = CSVReaderDataTable.GetCSVData("InputDataContent", pageName, "weightdata");
            List <string[]> historydata = CSVReaderDataTable.GetCSVData("CommonContent", pageName, "nonblendedtrackerhistoryheader");

            Common date = new Common(softAssertions);

            date.VerifyDate();


            CommonTracker wt = new CommonTracker(softAssertions);
            int           changevalueindex = 0;

            int weightvalue = Convert.ToInt32(trackerdata.ElementAt(0)[4]);

            for (int i = 0; i <= 2; i++)
            {
                SeleniumKeywords.SetText(pageName, trackerdata.ElementAt(0)[3], weightvalue.ToString());
                JavaScriptKeywords.SetTextByControlId("DataPointDate", date.GetDate()[i]);
                wt.ClickUpdateButton();
                wt.ClickViewHistory();
                //System.Threading.Thread.Sleep(3000);
                if (i == 0)
                {
                    wt.ValidateHistoryHeader(historydata, pageName);
                    historydata = CSVReaderDataTable.GetCSVData("CommonContent", pageName, "nonblendedtrackerhistoryvalue");
                }

                String historytabledata = Convert.ToDateTime(date.GetDate()[i]).ToString("dddd, MMM dd yyyy") + "|" + weightvalue.ToString();
                historydata.ElementAt(changevalueindex)[4] = historytabledata;

                wt.ValidateHistoryData(historydata, pageName);
                weightvalue += 50;
            }
        }
Exemplo n.º 4
0
        public void TC_VerifyTrackerChart()
        {
            //Page_Login plogin = new Page_Login();
            //plogin.Login();
            //Page_HAPrompt haprompt = new Page_HAPrompt();
            //haprompt.GoToDashboard();

            CommonTracker wt = new CommonTracker(softassertions);

            wt.VerifyTrackerChart();

            is_soft_assert = true;
            softassertions.AssertAll();
        }
        /// <summary>
        ///     This method saves the model changes to the database.
        ///     If the tracker for an entity is active, it will also put the old values in tracking table.
        ///     Always use this method instead of SaveChanges() whenever possible.
        /// </summary>
        /// <param name="userName">Username of the logged in identity</param>
        /// <returns>Returns the number of objects written to the underlying database.</returns>
        public virtual int SaveChanges(object userName)
        {
            CommonTracker.AuditChanges(this, userName);

            IEnumerable<DbEntityEntry> addedEntries = CommonTracker.GetAdditions(this);
            // Call the original SaveChanges(), which will save both the changes made and the audit records...Note that added entry auditing is still remaining.
            int result = base.SaveChanges();
            //By now., we have got the primary keys of added entries of added entiries because of the call to savechanges.

            CommonTracker.AuditAdditions(this, userName, addedEntries);

            //save changes to audit of added entries
            base.SaveChanges();
            return result;
        }
Exemplo n.º 6
0
        public void TC_VerifyTrackerChart()
        {
            //Page_Login plogin = new Page_Login();
            //plogin.Login();
            //Page_HAPrompt haprompt = new Page_HAPrompt();
            //haprompt.GoToDashboard();

            //Common trackermenu = new Common();
            //trackermenu.ClickTrackerMenu();
            CommonTracker ct = new CommonTracker(softassertions);

            //Page_PhysActivityTracker pa = new Page_PhysActivityTracker(softassertions);
            //pa.NavigateToPhysicalActivityTracker();
            ct.VerifyTrackerChart();

            is_soft_assert = true;
            softassertions.AssertAll();

            Common logout = new Common();

            logout.LogOut();
        }
Exemplo n.º 7
0
        public void TC_WeightTracker()
        {
            incentiveEnabled = cmn.GetConfig("IncentiveEnabled").ElementAt(0)[1].ToLower();

            if (incentiveEnabled.Equals("true"))
            {
                points = cmn.GetPoints(clientname);
            }

            Page_WeightTracker pWeightTracker = new Page_WeightTracker(softassertions);

            pWeightTracker.GoToWeightTracker();
            pWeightTracker.VerifyWeightTracker(clientname);
            CommonTracker ct = new CommonTracker(softassertions);

            ct.VerifyTrackerChart();


            if (!incentiveEnabled.Equals("false"))
            {
                //Assert.Ignore("Incentives not enabled for client");


                WeightTracker wt = new WeightTracker();
                wt.TC_ValidateTrackerIncentiveHistory();

                int awardedpoints = cmn.GetPoints(clientname);

                int points_tracker      = Convert.ToInt32(cmn.GetInstancePointsValue(clientname, "Tracker"));
                int expectedtotalpoints = points + points_tracker;

                Console.WriteLine("Expected : " + expectedtotalpoints);
                Console.WriteLine("Awarded : " + awardedpoints);
                Assert.AreEqual(expectedtotalpoints, awardedpoints);
            }

            is_soft_assert = true;
            softassertions.AssertAll();
        }
        public void TC_VerifyTrackerChart()
        {
            if (GlobalVariables.clientname == "NUCOR")
            {
                Assert.Ignore("The current testcase is not available for the client" + GlobalVariables.clientname);
            }
            else
            {
                //Page_Login plogin = new Page_Login();
                //plogin.Login();
                //Page_HAPrompt haprompt = new Page_HAPrompt();
                //haprompt.GoToDashboard();

                CommonTracker sl = new CommonTracker(softassertions);
                sl.VerifyTrackerChart();

                is_soft_assert = true;
                softassertions.AssertAll();

                Common logout = new Common();
                logout.LogOut();
            }
        }
 /// <summary>
 ///     Get all logs for the given entity name
 /// </summary>
 /// <param name="entityName">full name of entity</param>
 /// <returns></returns>
 public IQueryable <AuditLog> GetLogs(string entityName)
 {
     return(CommonTracker.GetLogs(this, entityName));
 }
 /// <summary>
 ///     Get all logs for the given model type
 /// </summary>
 /// <typeparam name="TTable">Type of domain model</typeparam>
 /// <returns></returns>
 public IQueryable <AuditLog> GetLogs <TTable>()
 {
     return(CommonTracker.GetLogs <TTable>(this));
 }
 /// <summary>
 ///     Get the id of the most recently created log for the given table name for a specific record
 /// </summary>
 /// <param name="tableName">table name</param>
 /// <param name="primaryKey">primary key of record</param>
 /// <returns>Log id</returns>
 public long GetLastAuditLogId(string tableName, object primaryKey)
 {
     return(CommonTracker.GetLastAuditLogId(this, tableName, primaryKey));
 }
 /// <summary>
 ///     Get all logs for the given entity name for a specific record
 /// </summary>
 /// <param name="entityName">full name of entity</param>
 /// <param name="primaryKey">primary key of record</param>
 /// <returns></returns>
 public IQueryable <AuditLog> GetLogs(string entityName, object primaryKey)
 {
     return(CommonTracker.GetLogs(this, entityName, primaryKey));
 }
 /// <summary>
 ///     Get all logs for the given model type for a specific record
 /// </summary>
 /// <typeparam name="TTable">Type of domain model</typeparam>
 /// <param name="primaryKey">primary key of record</param>
 /// <returns></returns>
 public IQueryable <AuditLog> GetLogs <TTable>(object primaryKey)
 {
     return(CommonTracker.GetLogs <TTable>(this, primaryKey));
 }