public void ToOffsetDateTime_AndToDateTimeOffset_ConvertsMaxInstantToMaxDateTimeOffset(Offset offset) { var offsetDateTime = NodaTimeConverter.ToOffsetDateTime(Instant.MaxValue, offset); var dateTimeOffset = NodaTimeConverter.ToDateTimeOffset(offsetDateTime); dateTimeOffset.Should().Be(DateTimeOffset.MaxValue); }
public void ToDateTimeOffset_GivenMaxDateTimeInstant_WithZeroOffset_Throws() { var maxDateTimeInstant = NodaTimeConverter.MaxDateTimeInstant; var offsetDateTimeWithMaxInstant = NodaTimeConverter.ToOffsetDateTime(maxDateTimeInstant, Offset.Zero); Action toDateTimeOffset = () => NodaTimeConverter.ToDateTimeOffset(offsetDateTimeWithMaxInstant); toDateTimeOffset.ShouldThrow <ArgumentOutOfRangeException>(); }
public void ToOffsetDateTime_GivenInstant_ReturnsExpected(Offset offset) { var time = _fixture.Create <Instant>(); var offsetDateTime = NodaTimeConverter.ToOffsetDateTime(time, offset); offsetDateTime.ToInstant().Should().Be(time); offsetDateTime.Offset.Should().Be(offset); }
public void ToOffsetDateTime_GivenMaxValue_ReturnsMaxOffsetDateTime(Offset offset) { var maxOffsetDateTime = NodaTimeConverter.ToOffsetDateTime(Instant.MaxValue, offset); maxOffsetDateTime.Should().Be(NodaTimeConverter.MaxOffsetDateTime); }
public void ToOffsetDateTime_GivenMinValue_ReturnsOffsetDateTime_WithMinInstantValue(Offset offset) { var minOffsetDateTime = NodaTimeConverter.ToOffsetDateTime(Instant.MinValue, offset); minOffsetDateTime.ToInstant().Should().Be(Instant.MinValue); }