public void DefaultActionValue_Execute_WithActionOverrides() { int location = 10; IValuable <G> overrideActionValue = Mock.Of <IValuable <G> >(); Dictionary <int, IValuable <G> > actionOverrides = new Dictionary <int, IValuable <G> > { { location, overrideActionValue } }; G groupState = Mock.Of <G>(m => m.ActionOverrides == actionOverrides); ExecutionState <G> executionState = new ExecutionState <G>(groupState); IValueProvider <G> valueProvider = Mock.Of <IValueProvider <G> >(); DefaultActionValue <G> sut = new DefaultActionValue <G>(groupState, location); sut.Execute(executionState, valueProvider); Mock.Get(overrideActionValue).Verify(m => m.Execute(executionState, valueProvider), Times.Once); }
public void DefaultActionValue_Execute_NoActionOverrides() { int location = 10; StackValuePointer <G>[] initStackPointers = new[] { new StackValuePointer <G>(), new StackValuePointer <G>() }; G groupState = Mock.Of <G>(); ExecutionState <G> executionState = new ExecutionState <G>(groupState); IValueProvider <G> valueProvider = Mock.Of <IValueProvider <G> >(); DefaultActionValue <G> sut = new DefaultActionValue <G>(groupState, location); sut.InitStackPointers.AddRange(initStackPointers); sut.Execute(executionState, valueProvider); Assert.Equal(initStackPointers, executionState.StackPointers); Assert.Equal(location - 1, executionState.InstructionIndex); Assert.Equal(groupState, executionState.GroupState); }