Example #1
0
        public void PostsUtil_ShouldReturnOneMonth()
        {
            creationDate = DateTime.Now.AddMonths(-1);
            string expectedResult = PostUtil.GetTimeAgoFromDateTime(creationDate);

            expectedResult.Should().Be("1 mês atrás");
        }
Example #2
0
        public void PostsUtil_ShouldReturnOneWeek()
        {
            creationDate = DateTime.Now.AddDays(-7);
            string expectedResult = PostUtil.GetTimeAgoFromDateTime(creationDate);

            expectedResult.Should().Be("1 semana atrás");
        }
Example #3
0
        public void PostsUtil_ShouldReturnTwoDays()
        {
            creationDate = DateTime.Now.AddDays(-2);
            string expectedResult = PostUtil.GetTimeAgoFromDateTime(creationDate);

            expectedResult.Should().Be("2 dias atrás");
        }
Example #4
0
        public void PostsUtil_ShouldReturnThirtylMinutes()
        {
            creationDate = DateTime.Now.AddMinutes(-30);
            string expectedResult = PostUtil.GetTimeAgoFromDateTime(creationDate);

            expectedResult.Should().Be("30 minutos atrás");
        }
Example #5
0
 public void SetUp()
 {
     _repository = new Mock <IPostRepository>();
     _service    = new PostService(_repository.Object);
     _post       = new Post()
     {
         Id              = 1,
         Message         = "asd",
         PostDate        = DateTime.Now,
         DisplayPostDate = PostUtil.GetTimeAgoFromDateTime(DateTime.Now)
     };
 }
Example #6
0
        public Post Make(ITweet tweet)
        {
            if (tweet == null)
            {
                return(null);
            }

            Post post = new Post()
            {
                Id              = tweet.Id,
                Message         = tweet.Text,
                PostDate        = tweet.CreatedAt,
                DisplayPostDate = PostUtil.GetTimeAgoFromDateTime(tweet.CreatedAt)
            };

            return(post);
        }