コード例 #1
0
        public void BeforeDSTDay()
        {
            var ctrl = new CnDTimeInputOffset3H();
            ctrl.SelectedDateTime = new DateTime(2015, 10, 25, 1, 0, 0, DateTimeKind.Local);
            ctrl.OnTimeChanged(TimeSpan.FromHours(10));

            Assert.That(ctrl.SelectedDateTime, Is.EqualTo(new DateTime(2015, 10, 24, 10, 0, 0, DateTimeKind.Local)));
        }
コード例 #2
0
        public void AfterDSTDay()
        {
            var ctrl = new CnDTimeInputOffset3H();

            ctrl.SelectedDateTime = new DateTime(2015, 10, 25, 5, 0, 0, DateTimeKind.Local);
            ctrl.OnTimeChanged(TimeSpan.FromHours(10));

            Assert.That(ctrl.SelectedDateTime, Is.EqualTo(new DateTime(2015, 10, 25, 10, 0, 0, DateTimeKind.Local)));
        }
コード例 #3
0
        public void DSTWinter()
        {
            var ctrl = new CnDTimeInputOffset3H();

            ctrl.SelectedDateTime = new DateTime(2015, 10, 24, 3, 0, 0, DateTimeKind.Local);
            ctrl.OnTimeChanged(TimeSpan.FromMinutes(140)); // Add 2h20
            ctrl.IsSummerPeriod = false;

            var expected = new DateTime(2015, 10, 25, 1, 20, 0, DateTimeKind.Utc);

            Assert.That(ctrl.SelectedDateTime, Is.EqualTo(expected.ToLocalTime()));
        }
コード例 #4
0
        public void BeforeDSTCheckIsSummerPeriod()
        {
            var ctrl = new CnDTimeInputOffset3H();
            ctrl.SummerPeriodChanged += b =>
            {
                _isSummerPeriodByPropertyChanged = b;
            };
            _isSummerPeriodByPropertyChanged = ctrl.IsSummerPeriod;
            Assert.That(ctrl.IsSummerPeriod, Is.EqualTo(false), "IsSummerPeriod is true.");
            ctrl.SelectedDateTime = new DateTime(2015, 10, 24, 10, 0, 0, DateTimeKind.Local);

            Assert.That(ctrl.SelectedDateTime, Is.EqualTo(new DateTime(2015, 10, 24, 10, 0, 0, DateTimeKind.Local)), "SelectedDateTime is bad.");
            Assert.That(ctrl.IsSummerPeriod, Is.EqualTo(true), "IsSummerPeriod is false.");
            Assert.That(_isSummerPeriodByPropertyChanged, Is.EqualTo(true), "_isSummerPeriodByPropertyChanged is false.");
        }
コード例 #5
0
        public void BeforeDSTCheckIsSummerPeriod()
        {
            var ctrl = new CnDTimeInputOffset3H();

            ctrl.SummerPeriodChanged += b =>
            {
                _isSummerPeriodByPropertyChanged = b;
            };
            _isSummerPeriodByPropertyChanged = ctrl.IsSummerPeriod;
            Assert.That(ctrl.IsSummerPeriod, Is.EqualTo(false), "IsSummerPeriod is true.");
            ctrl.SelectedDateTime = new DateTime(2015, 10, 24, 10, 0, 0, DateTimeKind.Local);

            Assert.That(ctrl.SelectedDateTime, Is.EqualTo(new DateTime(2015, 10, 24, 10, 0, 0, DateTimeKind.Local)), "SelectedDateTime is bad.");
            Assert.That(ctrl.IsSummerPeriod, Is.EqualTo(true), "IsSummerPeriod is false.");
            Assert.That(_isSummerPeriodByPropertyChanged, Is.EqualTo(true), "_isSummerPeriodByPropertyChanged is false.");
        }
コード例 #6
0
        public void DSTWinter()
        {
            var ctrl = new CnDTimeInputOffset3H();
            ctrl.SelectedDateTime = new DateTime(2015, 10, 24, 3, 0, 0, DateTimeKind.Local);
            ctrl.OnTimeChanged(TimeSpan.FromMinutes(140)); // Add 2h20
            ctrl.IsSummerPeriod = false;

            var expected = new DateTime(2015, 10, 25, 1, 20, 0, DateTimeKind.Utc);

            Assert.That(ctrl.SelectedDateTime, Is.EqualTo(expected.ToLocalTime()));
        }