コード例 #1
0
        public void ShouldCreateGridIfInputPathInputIsGiven()
        {
            const string inputPath = "/Users/mario.sinovcic/Documents/Acceleration/Katas/Game Of Life/Game Of Life/Game Of Life Tests/TestData/TestData1.json";
            var          result    = GameSetupFactory.CreateGameFromJsonFile(SetupType.PathName, inputPath);

            Assert.AreEqual(result.CellGrid[0, 0].CellStatus, CellStatus.Alive);
            Assert.AreEqual(result.CellGrid[0, 1].CellStatus, CellStatus.Dead);
        }
コード例 #2
0
        public void ShouldReturnCorrectNewGridGeneration()
        {
            var initialGeneration = new[, ] {
                { "o", "o", "o" }, { "o", "x", "o" }, { "o", "o", "o" }
            };
            var grid           = GameSetupFactory.CreateGridFromArray(SetupType.StringInput, initialGeneration);
            var ruleFactory    = new ClassicRuleFactory();
            var gameController = new GameController(ruleFactory);
            var result         = gameController.IterateGame(grid);

            Assert.AreEqual(result.CellGrid[1, 1].CellStatus, CellStatus.Dead);
        }
コード例 #3
0
 public Grid SetupGame()
 {
     return(GameSetupFactory.CreateGrid(SetupType.Random));
 }
コード例 #4
0
        public void ShouldReturnErrorIfPathIsInvalid()
        {
            const string inputPath = "";

            Assert.Throws <ApplicationException>(() => GameSetupFactory.CreateGameFromJsonFile(SetupType.PathName, inputPath));
        }
コード例 #5
0
        public void ShouldCreateRandomGridIfNullInputIsGiven()
        {
            var result = GameSetupFactory.CreateGrid(SetupType.Random);

            Assert.AreNotEqual(null, result.CellGrid[0, 0]);
        }