Exemplo n.º 1
0
        public void ToOutputFormat_returns_correct_grammar_for_post_one_minute_ago()
        {
            string testMessage = "Everything may or may not be awesome";

            Post postOneMinuteAgo = new Post
            {
                Content = testMessage,
                PostedDateTime = DateTime.UtcNow.AddMinutes(-1)
            };

            Assert.AreEqual($"{testMessage} (1 minute ago)", postOneMinuteAgo.ToOutputFormat());
        }
Exemplo n.º 2
0
        public void ToOutPutFormat_returns_appropriate_time_units()
        {
            string testMessageSeconds = "Good morning world";
            string testMessageMinutes = "Good night world";
            string testMessageHours   = "Good afternoon world";
            string testMessageDays    = "Good evening world";

            Post testPostSeconds = new Post
            {
                Content = testMessageSeconds,
                PostedDateTime = DateTime.UtcNow.AddSeconds(-5)
            };

            Assert.AreEqual($"{testMessageSeconds} (5 seconds ago)", testPostSeconds.ToOutputFormat());

            Post testPostMinutes = new Post
            {
                Content = testMessageMinutes,
                PostedDateTime = DateTime.UtcNow.AddMinutes(-7)
            };

            Assert.AreEqual($"{testMessageMinutes} (7 minutes ago)", testPostMinutes.ToOutputFormat());

            Post testPostHours = new Post
            {
                Content = testMessageHours,
                PostedDateTime = DateTime.UtcNow.AddHours(-1)
            };

            Assert.AreEqual($"{testMessageHours} (1 hour ago)", testPostHours.ToOutputFormat());

            Post testPostDays = new Post
            {
                Content = testMessageDays,
                PostedDateTime = DateTime.UtcNow.AddDays(-9)
            };

            Assert.AreEqual($"{testMessageDays} (9 days ago)", testPostDays.ToOutputFormat());
        }
Exemplo n.º 3
0
        public void ToOutputFormat_returns_output_friendly_Post()
        {
            string testMessage = "Everything is awesome";

            Post testPost = new Post(testMessage);

            Assert.AreEqual($"{testMessage} (0 seconds ago)", testPost.ToOutputFormat());
        }