Beispiel #1
0
 public void TestToString()
 {
     Duration duration = new Duration(1, 43200.0);
     Assert.AreEqual(duration.ToString(), "1:43200");
 }
		[Test] public void MonthsToString ()
		{
			Duration d = new Duration(5, Duration.Unit.Months);
			Assert.AreEqual("5 Months", d.ToString());
		}
		[Test] public void DaysToString ()
		{
			Duration d = new Duration(5, Duration.Unit.Days);
			Assert.AreEqual("5 Days", d.ToString());
		}
		[Test] public void WeeksToString ()
		{
			Duration d = new Duration(5, Duration.Unit.Weeks);
			Assert.AreEqual("5 Weeks", d.ToString());
		}
Beispiel #5
0
 public void ToString_NonNormalized()
 {
     // Just a single example should be sufficient...
     var duration = new Duration { Seconds = 1, Nanos = -1 };
     Assert.AreEqual("{ \"@warning\": \"Invalid Duration\", \"seconds\": \"1\", \"nanos\": -1 }", duration.ToString());
 }