Esempio n. 1
0
        [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());
        }
Esempio n. 2
0
        [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");
        }
Esempio n. 3
0
        [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");
        }
        [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_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_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");
        }