예제 #1
0
        public void CheckIsInRangeTimeOnlyTest()
        {
            var lowerValue           = new TimeOnly(1, 3, 3);
            var upperValue           = new TimeOnly(10, 3, 3);
            var testValue            = new TimeOnly(5, 3, 20);
            var outOfRangeLowerValue = new TimeOnly(1, 3, 3);
            var outOfRangeUpperValue = new TimeOnly(2, 3, 3);

            Assert.IsTrue(testValue.CheckIsInRange(lowerValue, upperValue));

            Assert.IsFalse(testValue.CheckIsInRange(outOfRangeLowerValue, outOfRangeUpperValue));

            // Test Exception
            _ = Assert.ThrowsException <InvalidValueException <TimeOnly> >(() => testValue.CheckIsInRange(outOfRangeLowerValue, outOfRangeUpperValue, true));
        }