public void Get_SingleValueSet_ValueIsEqual() { NKMRandom.Set("test", 3); int?value = NKMRandom.Get("test"); Assert.Equal(3, value); }
public void Get_SecondTimeAfterSingleSet_ValueIsNull() { NKMRandom.Set("test", 3); NKMRandom.Get("test"); int?secondValue = NKMRandom.Get("test"); Assert.Null(secondValue); }
public void MakeAction(string[] action) { switch (action[0]) { //TODO: Remove that all and work with clicks maybe, or not case "CHARACTER PLACED": string[] data = action[1].SplitData(); Character character = Characters.First(c => c.ToString() == data[0]); HexCell cell = HexMapDrawer.Cells.First(c => c.ToString() == data[1]); PlaceCharacter(character, cell); break; case "TURN FINISHED": Active.Turn.Finish(); break; case "ACTION TAKEN": Characters.First(c => c.ToString() == action[1]).TryToInvokeJustBeforeFirstAction(); break; case "MOVE": List <HexCell> moveCells = action[1].SplitData().ConvertToHexCellList(); Active.Turn.CharacterThatTookActionInTurn.MakeActionBasicMove(moveCells); break; case "BASIC ATTACK": Character targetCharacter = Characters.First(c => c.ToString() == action[1]); Active.Turn.CharacterThatTookActionInTurn.MakeActionBasicAttack(targetCharacter); break; case "ABILITY CLICK": ((IClickable)Abilities.First(a => a is IClickable && a.ID == int.Parse(action[1]))).Click(); break; case "ABILITY USE": List <HexCell> targetCells = action[1].SplitData().ConvertToHexCellList(); // ((IUseable) Abilities.First(a => a is IUseable && a.ID == abilityID)).Use(targetCells); Active.AbilityToUse.Use(targetCells); break; case "ABILITY CANCEL": ((Ability)Active.AbilityToUse).Cancel(); break; case "RNG": string[] rngData = action[1].SplitData(); NKMRandom.Set(rngData[0], int.Parse(rngData[1])); break; default: Console.Instance.DebugLog("Unknown action in GameLog!"); break; } }
public void Get_SeveralTimesAfterSeveralValueSet_ValuesGetProperly() { NKMRandom.Set("test", 3); NKMRandom.Set("other", 6); NKMRandom.Set("test", 133); int?value1 = NKMRandom.Get("test"); int?value2 = NKMRandom.Get("test"); int?value3 = NKMRandom.Get("other"); int?value4 = NKMRandom.Get("other"); Assert.Equal(133, value1); Assert.Null(value2); Assert.Equal(6, value3); Assert.Null(value4); }