Exemplo n.º 1
0
        public void IntersectionTest1()
        {
            var start     = new DateTime(2015, 12, 12, 10, 12, 12);
            var finish    = new DateTime(2015, 12, 12, 18, 12, 13);
            var date      = new DateTime(2015, 12, 12, 14, 12, 12);
            var interval  = new TimeInterval.TimeInterval(start, date);
            var interval1 = new TimeInterval.TimeInterval(date, finish);

            Assert.IsFalse(interval.Intersection(interval1));
        }
Exemplo n.º 2
0
        public void CompareOperationTest1()
        {
            var start     = new DateTime(2015, 12, 12, 10, 12, 12);
            var finish    = new DateTime(2015, 12, 12, 18, 12, 13);
            var date      = new DateTime(2015, 12, 12, 14, 12, 12);
            var interval  = new TimeInterval.TimeInterval(start, finish);
            var interval1 = new TimeInterval.TimeInterval(date, finish);

            Assert.IsFalse(interval > interval1);
        }
Exemplo n.º 3
0
        public void InitializationTestExeption()
        {
            var start = new DateTime(2015, 12, 12, 12, 12, 12);

            try
            {
                var interval = new TimeInterval.TimeInterval(start, start);
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Начало и конец не может быть одинаковым", ex.Message);
            }
        }
Exemplo n.º 4
0
        public void IntersectionIntervalTest1()
        {
            var start     = new DateTime(2015, 12, 12, 10, 12, 12);
            var finish    = new DateTime(2015, 12, 12, 18, 12, 13);
            var date      = new DateTime(2015, 12, 12, 14, 12, 12);
            var interval  = new TimeInterval.TimeInterval(start, new DateTime());
            var interval1 = new TimeInterval.TimeInterval(date, finish);

            try
            {
                interval.IntersectionInterval(interval1);
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Интервалы не пересекаются", ex.Message);
            }
        }