Пример #1
0
        public void ShouldInvokePropertyChangedEvent_WhenValueIsChanged()
        {
            if (!_valueAndTypeStoredTestPassed)
            {
                Assert.Inconclusive("Required test \"ShouldStoreValueAndTypeCorrectly_WhenConstructorIsCalled\" did not pass");
            }

            const double            previousValue   = 2d;
            const double            newValue        = 8d;
            var                     testProperty    = new Property(previousValue);
            var                     propertyChanged = false;
            UserPropertyChangedArgs eventArgs       = null;

            testProperty.PropertyChanged += (sender, args) =>
            {
                propertyChanged = true;
                eventArgs       = args;
            };

            testProperty.Value = newValue;

            Assert.IsTrue(propertyChanged);
            Assert.AreEqual(previousValue, eventArgs.ValueBefore);
            Assert.AreEqual(newValue, eventArgs.ValueAfter);

            _eventCalledTestPassed = true;
        }
Пример #2
0
 protected override void OnTickrateChange(object source, UserPropertyChangedArgs args)
 {
     interval = CalculateInterval(args.ValueAfter);
 }
Пример #3
0
 /// <summary>
 /// Event if the tickrate changes
 /// </summary>
 /// <param name="source"></param>
 /// <param name="args"></param>
 protected override void OnTickrateChange(object source, UserPropertyChangedArgs args)
 {
     timer.Interval = new TimeSpan(0, 0, 0, 0, CalculateInterval(args.ValueAfter));
 }
Пример #4
0
 /// <summary>
 /// Event if the tickrate changes
 /// </summary>
 /// <param name="source"></param>
 /// <param name="args"></param>
 protected abstract void OnTickrateChange(object source, UserPropertyChangedArgs args);