// 현재 상태를 변경해준다 public void SetState(State.StateType type) { State state = noneCoinState; switch (type) { case State.StateType.NONECOIN: state = noneCoinState; break; case State.StateType.HASCOIN: state = hasCoinState; break; case State.StateType.SOLD: state = soldState; break; case State.StateType.SOLDOUT: state = soldOutState; break; } currentState = state; }
public void GetStateBaseSteps_StateFromSource_ReturnsStepsOrEmptyList( Dictionary <string, List <BaseStep> > addingStates, State.StateType selectedState, List <BaseStep> expectedSteps, BaseOperation customizableOper) { FillBaseOperationStatesWithReset(customizableOper, addingStates); List <BaseStep> actualSteps = customizableOper .GetStateBaseSteps(selectedState); Assert.Multiple(() => { for (int stepId = 0; stepId < actualSteps.Count; stepId++) { BaseStep expectedStep = expectedSteps[stepId]; BaseStep actualStep = actualSteps[stepId]; bool areEqual = expectedStep.DefaultPosition == actualStep.DefaultPosition && expectedStep.LuaName == actualStep.LuaName && expectedStep.Name == actualStep.Name && expectedStep.Owner == actualStep.Owner; Assert.IsTrue(areEqual); } }); }
public List <BaseStep> GetStateBaseSteps(State.StateType stateType) { var steps = new List <BaseStep>(); if (StateExist(stateType)) { steps = states[$"{stateType}"]; } return(steps); }
public List <string> GetStateStepsNames(State.StateType stateType) { var stepsNames = new List <string>(); if (StateExist(stateType)) { stepsNames = states[$"{stateType}"] .Select(x => x.Name).ToList(); } return(stepsNames); }
public void GetStateStepsNames_StateFromSource_ReturnsNamesOrEmptyList( BaseOperation customizableOper, State.StateType selectedType, Dictionary <string, List <BaseStep> > addingStates, List <string> expectedNames) { FillBaseOperationStatesWithReset(customizableOper, addingStates); List <string> actualNames = customizableOper .GetStateStepsNames(selectedType); Assert.AreEqual(expectedNames, actualNames); }
private bool StateExist(State.StateType stateType) { string stateTypeStr = stateType.ToString(); return(states.ContainsKey(stateTypeStr)); }