public void GivenTheFollowingCommandsAreExecuted(TechTalk.SpecFlow.Table table) { var robot = this.scenarioContext.Get <Robot>("robot"); var commands = new List <object>(); IEnumerable <CommandDetails> commandDetails = table.CreateSet <CommandDetails>(); foreach (var commandDetail in commandDetails) { #pragma warning disable CS8509 // The switch expression does not handle all possible values of its input type (it is not exhaustive). object x = commandDetail.commandType switch { CommandTypes.Place => new PlaceCommand(robot, new Bearing { Position = new Position(commandDetail.x, commandDetail.y), Orientation = commandDetail.orientation.ToEnum <Orientation>() } ), CommandTypes.Move => new MoveCommand(robot), CommandTypes.Report => new ReportCommand(robot), CommandTypes.Left => new TurnCommand(robot, Direction.Left), CommandTypes.Right => new TurnCommand(robot, Direction.Right) }; #pragma warning restore CS8509 // The switch expression does not handle all possible values of its input type (it is not exhaustive). commands.Add(x); } this.scenarioContext.Set(commands, "commands"); }
public void ThenTheOutputContains(string p0, TechTalk.SpecFlow.Table table) { IEnumerable <ReportDetails> reports = table.CreateSet <ReportDetails>(); var output = this.scenarioContext.Get <string[]>("reports"); foreach (var report in reports) { Assert.Equal(report.report, output[report.id - 1]); } }