예제 #1
0
        public void GetElapsedTime_Morethan1Minute_ShouldContainCorrectOutput()
        {
            var postedTime = DateTime.Now.AddSeconds(-61);

            var result = PresenterService.GetElapsedTime(postedTime);

            Assert.That(result, Is.EqualTo(" (1 minutes and 1 seconds ago.)"));
        }
        public string Render(IEnumerable <Post_DTO> input)
        {
            var _output = new StringBuilder();

            if (input != null)
            {
                IEnumerable <Post_DTO> orderedList = input.OrderByDescending(cd => cd.CreatedDateStamp);

                foreach (var _item in orderedList)
                {
                    _output.Append(_item.CreatedBy + " - " + _item.Detail + PresenterService.GetElapsedTime(_item.CreatedDateStamp));
                    _output.AppendLine();
                }
            }

            // DEFAULT RETURN:
            return(_output.ToString());
        }
        public string Render(User_DTO user)
        {
            var _output = new StringBuilder();

            if (user != null)
            {
                var posts = user.Posts.ToList();
                posts.Reverse();

                foreach (var _item in posts)
                {
                    _output.Append(_item.Detail + PresenterService.GetElapsedTime(_item.CreatedDateStamp));
                    _output.AppendLine();
                }
            }

            // DEFAULT RETURN:
            return(_output.ToString());
        }