コード例 #1
0
 public void FourteenDaysAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 15, 0, 0, 0, 0);
     Assert.AreEqual("2 weeks ago", d.PrettyDate(now));
 }
コード例 #2
0
 public void WhenIsNow()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     Assert.AreEqual("just now", d.PrettyDate(now));
 }
コード例 #3
0
 public void FiftyNineSecondsAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 0, 0, 59, 999);
     Assert.AreEqual("just now", d.PrettyDate(now));
 }
コード例 #4
0
 public void OneMinuteFiftyNineSecondsAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 0, 1, 59, 999);
     Assert.AreEqual("1 minute ago", d.PrettyDate(now));
 }
コード例 #5
0
ファイル: NewsItem.cs プロジェクト: dirkrombauts/SirenOfShame
 private void WriteDate(DateTime eventDate)
 {
     _when.Text = eventDate.PrettyDate();
 }
コード例 #6
0
 public void OneDayTwentyThreeHoursAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 2, 23, 59, 59, 999);
     Assert.AreEqual("yesterday", d.PrettyDate(now));
 }
コード例 #7
0
 public void OneHourFiftyNineMinutesAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 1, 59, 59, 999);
     Assert.AreEqual("1 hour ago", d.PrettyDate(now));
 }
コード例 #8
0
 public void ThreeWeeksAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 28, 23, 59, 59, 999);
     Assert.AreEqual("3 weeks ago", d.PrettyDate(now));
 }
コード例 #9
0
 public void TwentyThreeHoursAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 23, 59, 59, 999);
     Assert.AreEqual("23 hours ago", d.PrettyDate(now));
 }
コード例 #10
0
 public void SixDaysAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 7, 23, 59, 59, 999);
     Assert.AreEqual("6 days ago", d.PrettyDate(now));
 }
コード例 #11
0
 public void ThirteenDaysAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 14, 23, 59, 59, 999);
     Assert.AreEqual("last week", d.PrettyDate(now));
 }
コード例 #12
0
 public void SevenDaysAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 8, 0, 0, 0, 0);
     Assert.AreEqual("last week", d.PrettyDate(now));
 }
コード例 #13
0
 public void OneYearAgo()
 {
     var d = new DateTime(2009, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 2, 5, 0, 0, 0, 0);
     Assert.AreEqual(d.ToString("d"), d.PrettyDate(now));
 }
コード例 #14
0
 public void OneMonthAgoMin()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 2, 5, 0, 0, 0, 0);
     Assert.AreEqual("1 month ago", d.PrettyDate(now));
 }
コード例 #15
0
 public void FourWeeksAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 2, 4, 23, 59, 59, 999);
     Assert.AreEqual("4 weeks ago", d.PrettyDate(now));
 }
コード例 #16
0
 public void TwoDaysAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 3, 0, 0, 0, 0);
     Assert.AreEqual("2 days ago", d.PrettyDate(now));
 }
コード例 #17
0
 public void OneDayAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 2, 0, 0, 0, 0);
     Assert.AreEqual("yesterday", d.PrettyDate(now));
 }
コード例 #18
0
 public void TwoHoursAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 2, 0, 0, 0);
     Assert.AreEqual("2 hours ago", d.PrettyDate(now));
 }
コード例 #19
0
 public void OneHourAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 1, 0, 0, 0);
     Assert.AreEqual("1 hour ago", d.PrettyDate(now));
 }
コード例 #20
0
 public void TwoMinutesAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 0, 2, 0, 0);
     Assert.AreEqual("2 minutes ago", d.PrettyDate(now));
 }
コード例 #21
0
 public void OneMinuteAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 1, 1, 0, 1, 0, 0);
     Assert.AreEqual("1 minute ago", d.PrettyDate(now));
 }
コード例 #22
0
 public void TwoMonthsAgoMin()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 3, 3, 0, 0, 0, 0);
     Assert.AreEqual("2 months ago", d.PrettyDate(now));
 }
コード例 #23
0
 public void OneMonthAgoMax()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 3, 1, 23, 59, 59, 999);
     Assert.AreEqual("1 month ago", d.PrettyDate(now));
 }
コード例 #24
0
 public void OverFourWeeksAgo()
 {
     var d = new DateTime(2010, 1, 1, 0, 0, 0, 0);
     var now = new DateTime(2010, 2, 5, 0, 0, 0, 0);
     Assert.AreEqual(d.ToString("d"), d.PrettyDate(now));
 }