public void LockedVariableValueDoesNotChange()
        {
            var variable = new PlanVariable(string.Empty, 100, true, new List <Action>());
            var attempt  = variable.Update(200);

            Assert.Same(variable, attempt);
        }
        public void UnlockedVariableValueDoesChange()
        {
            const decimal newValue = 200;
            var           variable = new PlanVariable(string.Empty, 100, false, new List <Action>());
            var           attempt  = variable.Update(newValue);

            Assert.Equal(newValue, attempt.Value);
            Assert.NotSame(variable, attempt);
        }
        public void EventHappensOnChangedValue()
        {
            var variable      = new PlanVariable(string.Empty, 100, false, new List <Action>());
            var eventHappened = false;

            variable.Subscripe(() => eventHappened = true);
            variable.Update(200);
            Assert.True(eventHappened);
        }
        public void StartWithLockAndThenUnlock()
        {
            const decimal newValue = 200;
            var           variable = new PlanVariable(string.Empty, 100, true, new List <Action>());
            var           unlocked = variable.Unlock();
            var           attempt  = unlocked.Update(newValue);

            Assert.Equal(newValue, attempt.Value);
            Assert.NotSame(unlocked, attempt);
        }
        public void StartWithUnlockAndThenLock()
        {
            const decimal newValue = 200;
            var           variable = new PlanVariable(string.Empty, 100, false, new List <Action>());
            var           locked   = variable.Lock();
            var           attempt  = locked.Update(newValue);

            Assert.Equal(variable.Value, locked.Value);
            Assert.Same(locked, attempt);
        }
示例#6
0
 public void ChangeTheValue(decimal value)
 {
     variable = variable.Update(value);
 }
示例#7
0
 public void UnlockedPlanVariable(decimal startValue)
 {
     variable = new PlanVariable("spec", startValue, false, new List <System.Action>());
     variable.Subscripe(() => eventSubscription = true);
 }
示例#8
0
 public void LockedPlanVariable(decimal startValue)
 {
     variable = new PlanVariable("spec", startValue, true, new List <System.Action>());
 }