예제 #1
0
        public void TestArgumentNotOfTypeDateTime()
        {
            SetThreadCulture();

            string result = new DateTimeAgoConverter().Convert(4, typeof(string), null, Thread.CurrentThread.CurrentCulture) as string;

            Assert.Equal(result, string.Empty);
        }
예제 #2
0
        public void TestArgumentOfYesterday()
        {
            SetThreadCulture();

            DateTime dateTime = DateTime.Now.AddDays(-1);

            string result = new DateTimeAgoConverter().Convert(dateTime, typeof(string), null, Thread.CurrentThread.CurrentCulture) as string;

            Assert.Equal(result, dateTime.ToShortDateString());
        }
        public void TestArgumentOfSameDay()
        {
            SetThreadCulture();

            DateTime dateTime = DateTime.Now;

            string result = new DateTimeAgoConverter().Convert(dateTime, typeof(string), null, Thread.CurrentThread.CurrentCulture) as string;

            Assert.AreEqual(result, dateTime.ToShortTimeString());
        }