public void RoundFloor()
 {
     DateTimeField field = new StubPreciseDurationDateTimeField();
     Assert.AreEqual(-120L, field.RoundFloor(new LocalInstant(-61L)).Ticks);
     Assert.AreEqual(-60L, field.RoundFloor(new LocalInstant(-60L)).Ticks);
     Assert.AreEqual(-60L, field.RoundFloor(new LocalInstant(-59L)).Ticks);
     Assert.AreEqual(-60L, field.RoundFloor(new LocalInstant(-1L)).Ticks);
     Assert.AreEqual(0L, field.RoundFloor(new LocalInstant(0L)).Ticks);
     Assert.AreEqual(0L, field.RoundFloor(new LocalInstant(1L)).Ticks);
     Assert.AreEqual(0L, field.RoundFloor(new LocalInstant(29L)).Ticks);
     Assert.AreEqual(0L, field.RoundFloor(new LocalInstant(30L)).Ticks);
     Assert.AreEqual(0L, field.RoundFloor(new LocalInstant(31L)).Ticks);
     Assert.AreEqual(60L, field.RoundFloor(new LocalInstant(60L)).Ticks);
 }
 public void LeapDurationField_DefaultsToNull()
 {
     DateTimeField field = new StubPreciseDurationDateTimeField();
     Assert.IsNull(field.LeapDurationField);
 }
 public void GetMinimumValue_DefaultsTo0()
 {
     DateTimeField field = new StubPreciseDurationDateTimeField();
     Assert.AreEqual(0L, field.GetMinimumValue());
 }
 public void IsLeap_DefaultsToFalse()
 {
     DateTimeField field = new StubPreciseDurationDateTimeField();
     Assert.IsFalse(field.IsLeap(new LocalInstant(0L)));
 }
 public void GetLeapAmount_DefaultsTo0()
 {
     DateTimeField field = new StubPreciseDurationDateTimeField();
     Assert.AreEqual(0L, field.GetLeapAmount(new LocalInstant(0L)));
 }
 public void SetValue()
 {
     DateTimeField field = new StubPreciseDurationDateTimeField();
     Assert.AreEqual(0, field.SetValue(new LocalInstant(120L), 0).Ticks);
     Assert.AreEqual(29 * 60, field.SetValue(new LocalInstant(120L), 29).Ticks);
 }
 public void IsLenient_ReturnsFalse()
 {
     DateTimeField field = new StubPreciseDurationDateTimeField();
     Assert.IsFalse(field.IsLenient);
 }
 public void FieldType_ReturnsTypePassedToConstructor()
 {
     DateTimeField field = new StubPreciseDurationDateTimeField();
     Assert.AreEqual(DateTimeFieldType.SecondOfMinute, field.FieldType);
 }
 public void Remainder()
 {
     DateTimeField field = new StubPreciseDurationDateTimeField();
     Assert.AreEqual(0L, field.Remainder(new LocalInstant(0L)).Ticks);
     Assert.AreEqual(29L, field.Remainder(new LocalInstant(29L)).Ticks);
     Assert.AreEqual(30L, field.Remainder(new LocalInstant(30L)).Ticks);
     Assert.AreEqual(31L, field.Remainder(new LocalInstant(31L)).Ticks);
     Assert.AreEqual(0L, field.Remainder(new LocalInstant(60L)).Ticks);
     Assert.AreEqual(57L, field.Remainder(new LocalInstant(-63L)).Ticks);
 }
 public void RoundHalfEven()
 {
     DateTimeField field = new StubPreciseDurationDateTimeField();
     Assert.AreEqual(0L, field.RoundHalfEven(new LocalInstant(0L)).Ticks);
     Assert.AreEqual(0L, field.RoundHalfEven(new LocalInstant(29L)).Ticks);
     Assert.AreEqual(0L, field.RoundHalfEven(new LocalInstant(30L)).Ticks);
     Assert.AreEqual(60L, field.RoundHalfEven(new LocalInstant(31L)).Ticks);
     Assert.AreEqual(60L, field.RoundHalfEven(new LocalInstant(60L)).Ticks);
     Assert.AreEqual(60L, field.RoundHalfEven(new LocalInstant(89L)).Ticks);
     Assert.AreEqual(120L, field.RoundHalfEven(new LocalInstant(90L)).Ticks);
     Assert.AreEqual(120L, field.RoundHalfEven(new LocalInstant(91L)).Ticks);
 }