ToString() public method

public ToString ( ) : string
return string
コード例 #1
0
 public void NextYearButLessThanAYear()
 {
   var t2 = new DateTime(2010, 7, 10);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("10 months, 1 week, 2 days", o.ToString());
 }
コード例 #2
0
 public void NextMonthButLessThanAMonth() // Worked without changing code
 {
   var thePast = new DateTime(2009, 9, 10);
   var t2 = new DateTime(2009, 10, 2);
   var o = new PeriodOfTimeOutput(thePast, t2);
   Assert.AreEqual("3 weeks, 1 day", o.ToString());
 }
コード例 #3
0
 public void YearsAreAlsoOutput()
 {
   var t2 = new DateTime(2010, 9, 1);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("1 year", o.ToString());
 }
コード例 #4
0
 public void CombinationOfYearMonthWeekAndDayIsPossible()
 {
   var t2 = new DateTime(2010, 11, 10);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("1 year, 2 months, 1 week, 2 days", o.ToString());
 }
コード例 #5
0
 public void MonthsAreAlsoOutput()
 {
   var t2 = new DateTime(2009, 10, 1);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("1 month", o.ToString()); 
 }
コード例 #6
0
 public void CombinationsOfMonthAndWeekAndDayArePossible()
 {
   var t2 = new DateTime(2009, 10, 10);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("1 month, 1 week, 2 days", o.ToString());
 }
コード例 #7
0
 public void WeeksAppearWhenMoreThanAWeek()
 {
   var t2 = new DateTime(2009, 9, 17);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("2 weeks, 2 days", o.ToString());
 }
コード例 #8
0
 public void WeeksAreCorrectlyInflected()
 {
   var t2 = new DateTime(2009, 9, 9);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("1 week, 1 day", o.ToString()); 
 }
コード例 #9
0
 public void SmallestUnitIsToday()
 {
   var t2 = basePast;
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("today", o.ToString());
 }
コード例 #10
0
 public void CorrectlyOutputsASmallPeriodWithinWeek()
 {
   var t2 = new DateTime(2009, 9, 6);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("5 days", o.ToString());
 }
コード例 #11
0
 public void IssueInFindingAMonthWhenPastDateIs31St()
 {
   var past = new DateTime(2009, 8, 31);
   var now = new DateTime(2009, 10, 1);
   var o = new PeriodOfTimeOutput(past, now);
   Assert.AreEqual("1 month, 1 day", o.ToString());
 }
コード例 #12
0
 public void AVariantOfALongInterval()
 {
   var t2 = new DateTime(2012, 8, 30);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("2 years, 11 months, 4 weeks, 1 day", o.ToString());
 }
コード例 #13
0
 public void NextYearButLessThanAYearVariant2()
 {
   var otherBase = new DateTime(2009, 9, 10);
   var t2 = new DateTime(2010, 6, 2);
   var o = new PeriodOfTimeOutput(otherBase, t2);
   Assert.AreEqual("8 months, 3 weeks, 2 days", o.ToString());
 }