internal static IInstruction Parse(string[] splited) { PlayerName name; if (splited.Length == 4 && Enum.TryParse <PlayerName>(splited[1], true, out name) && name != PlayerName.None) { switch (splited[2]) { case "row_points": return(RowPointsInstruction.Parse(name, splited)); case "combo": return(ComboInstruction.Parse(name, splited)); case "skips": return(SkipsInstruction.Parse(name, splited)); case "field": return(FieldInstruction.Parse(name, splited)); } } return(null); }
public void Parse_SkipsInstruction_Player2Skips13() { var act = Instruction.Parse("update player2 skips 13"); var exp = new SkipsInstruction(PlayerName.Player2, 13); Assert.AreEqual(exp, act); }