示例#1
0
        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));
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
 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);
 }