Пример #1
0
        public void LockedVariableValueDoesNotChange()
        {
            var variable = new PlanVariable(string.Empty, 100, true, new List <Action>());
            var attempt  = variable.Update(200);

            Assert.Same(variable, attempt);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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>());
 }