ToString() public method

public ToString ( ) : string
return string
Ejemplo n.º 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());
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 3
0
 public void YearsAreAlsoOutput()
 {
   var t2 = new DateTime(2010, 9, 1);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("1 year", o.ToString());
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 5
0
 public void MonthsAreAlsoOutput()
 {
   var t2 = new DateTime(2009, 10, 1);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("1 month", o.ToString()); 
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 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()); 
 }
Ejemplo n.º 9
0
 public void SmallestUnitIsToday()
 {
   var t2 = basePast;
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("today", o.ToString());
 }
Ejemplo n.º 10
0
 public void CorrectlyOutputsASmallPeriodWithinWeek()
 {
   var t2 = new DateTime(2009, 9, 6);
   var o = new PeriodOfTimeOutput(basePast, t2);
   Assert.AreEqual("5 days", o.ToString());
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 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());
 }