Example #1
0
        public void TestCalcSubmissionAge()
        {
            DateTime testDate = DateTime.Now.AddDays(-2);
            string   result   = Submissions.CalcSubmissionAge(testDate);

            Assert.AreEqual("2 days", result, "Submission age was not calculated.");
        }
Example #2
0
        public void Calc_SubmissionAge_1_5years()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            string result = Submissions.CalcSubmissionAge(TimeSpan.FromDays(18 * 30));

            Assert.AreEqual("1.5 years", result, "Submission age was not calculated.");
        }
Example #3
0
        public ActionResult UserBasicInfo(string userName)
        {
            var userRegistrationDateTime = UserHelper.GetUserRegistrationDateTime(userName);
            var memberFor = Submissions.CalcSubmissionAge(userRegistrationDateTime);
            var scp       = Karma.LinkKarma(userName);
            var ccp       = Karma.CommentKarma(userName);

            var userInfoModel = new BasicUserInfo()
            {
                MemberSince = memberFor,
                Ccp         = ccp,
                Scp         = scp
            };

            return(PartialView("~/Views/AjaxViews/_BasicUserInfo.cshtml", userInfoModel));
        }
Example #4
0
        public void Calc_SubmissionAge_1year()
        {
            string result = Submissions.CalcSubmissionAge(TimeSpan.FromDays(370));

            Assert.AreEqual("1 year", result, "Submission age was not calculated.");
        }
Example #5
0
        public void Calc_SubmissionAge_8months()
        {
            string result = Submissions.CalcSubmissionAge(TimeSpan.FromDays(8 * 31));

            Assert.AreEqual("8 months", result, "Submission age was not calculated.");
        }
Example #6
0
        public void Calc_SubmissionAge_2Day()
        {
            string result = Submissions.CalcSubmissionAge(TimeSpan.FromDays(2));

            Assert.AreEqual("2 days", result, "Submission age was not calculated.");
        }
Example #7
0
        public void Calc_SubmissionAge_1minute()
        {
            string result = Submissions.CalcSubmissionAge(TimeSpan.FromMinutes(1));

            Assert.AreEqual("1 minute", result, "Submission age was not calculated.");
        }
Example #8
0
        public void Calc_SubmissionAge_30seconds()
        {
            string result = Submissions.CalcSubmissionAge(TimeSpan.FromSeconds(30));

            Assert.AreEqual("30 seconds", result, "Submission age was not calculated.");
        }