[TestMethod] // ReSharper disable once InconsistentNaming public void ToString_HasCorrectFormat() { Duration length = RandomDuration(MinDuration + MinDuration, MaxDuration); ZonedDateTime start = RandomZonedDateTime(TestMinZonedDateTime, TestMaxZonedDateTime - length); ZonedDateTime end = start + length; Duration step = RandomDuration(MinDuration, length - MinDuration); ZonedDateTimeRange zonedDateTimeRange = new ZonedDateTimeRange(start, end, step); Assert.AreEqual($"{start} - {end}", zonedDateTimeRange.ToString()); }
[TestMethod] // ReSharper disable once InconsistentNaming public void ToString_IsNotBlank() { Duration length = RandomDuration(MinDuration + MinDuration, MaxDuration); ZonedDateTime start = RandomZonedDateTime(TestMinZonedDateTime, TestMaxZonedDateTime - length); ZonedDateTime end = start + length; Duration step = RandomDuration(MinDuration, length - MinDuration); ZonedDateTimeRange zonedDateTimeRange = new ZonedDateTimeRange(start, end, step); Assert.AreNotEqual( "", zonedDateTimeRange.ToString(), "String representation of range must not be an empty string"); }
[TestMethod] // ReSharper disable once InconsistentNaming public void ToString_DoesDependOnTimeComponents() { Duration length = RandomDuration(MinDuration + MinDuration, MaxDuration); ZonedDateTime start = RandomZonedDateTime(TestMinZonedDateTime, TestMaxZonedDateTime - length); ZonedDateTime end = start + length; Duration step = RandomDuration(MinDuration, length - MinDuration); ZonedDateTimeRange zonedDateTimeRange = new ZonedDateTimeRange(start, end, step); ZonedDateTimeRange zonedDateTimeRangeWithTime = new ZonedDateTimeRange( start + RandomTimeOffset(), end + RandomTimeOffset(), step); Assert.AreNotEqual( zonedDateTimeRange.ToString(), zonedDateTimeRangeWithTime.ToString(), "String representation of range should depend on the time components"); }