public void CreateGameStateTest() { //Arrange var mock = new Mock <IGameService>(); var gameController = new GameController(mock.Object, null, null); //Act var options = new GameStateOptions(); gameController.CreateGameState(options); //Assert mock.Verify(g => g.CreateGameState(options)); }
public GameState CreateGameState(GameStateOptions options) { Field field = CreateField(options.x, options.y); field.Cells[0, 0].CurrentState = CellState.Robot; List <Cargo> cargos = CreateCargos(options.CargoAmount, options.MaxPrice, options.MaxWeight, options.IsDecoding); List <Cargo> toxicCargos = CreateToxicCargos(options.ToxicCargoAmount, options.MaxPrice, options.MaxWeight, options.IsDecoding); PlaceAllCargos(cargos, toxicCargos, options.x, options.y, field); var gameState = new GameState(field, options.CargoAmount + options.ToxicCargoAmount); gameState.PreviousStates.Push(CreatePreviousState(field)); return(gameState); }
public void CreateGameState_Test() { //Arrange var options = new GameStateOptions(5, 5, 5, 0, 10, 10, false); GameService service = new GameService(); //Act var gameState = service.CreateGameState(options); //Assert Assert.NotNull(gameState); var cargosResult = gameState.GameField.Where(c => c.CurrentState == CellState.Cargo || c.CurrentState == CellState.RobotCargo) .Count(); Assert.Equal(5, cargosResult); }
public void CreateGameState(GameStateOptions options) { gameState = gameService.CreateGameState(options); gameStateService = new GameStateService(gameState); }
protected override void OnEnter(object onEnterParams) { //prepare panel for the current GameState GameStateOptions = State as GameStateOptions; //widgetOptionsOverview.SetUpOverview(this); }