Beispiel #1
0
        public void GetTimeAgo_WhenGreaterThanADay_ReturnDays(double day, string timeAgo)
        {
            var sut      = new DateService();
            var now      = DateTimeOffset.Now;
            var datetime = now - TimeSpan.FromDays(day);

            var result = sut.GetTimeAgo(datetime);

            Assert.That(result, Is.EqualTo(timeAgo));
        }
Beispiel #2
0
        public void GetTimeAgo_WhenLessThanAnHour_ReturnMinutes(int min, string timeAgo)
        {
            var sut      = new DateService();
            var now      = DateTimeOffset.Now;
            var datetime = now - TimeSpan.FromMinutes(min);

            var result = sut.GetTimeAgo(datetime);

            Assert.That(result, Is.EqualTo(timeAgo));
        }
Beispiel #3
0
        public void GetTimeAgo_WhenLessThanADay_ReturnHours(int hour, string timeAgo)
        {
            var sut      = new DateService();
            var now      = DateTimeOffset.Now;
            var datetime = now - TimeSpan.FromHours(hour);

            var result = sut.GetTimeAgo(datetime);

            Assert.That(result, Is.EqualTo(timeAgo));
        }
Beispiel #4
0
        public void GetTimeAgo_WhenLessThanAMinute_ReturnSeconds(int sec, string timeAgo)
        {
            var sut      = new DateService();
            var now      = DateTimeOffset.Now;
            var datetime = now - TimeSpan.FromSeconds(sec);

            var result = sut.GetTimeAgo(datetime);

            Assert.That(result, Is.EqualTo(timeAgo));
        }