// POST api/<controller>
        public IHttpActionResult Post([FromBody] int[,] board)
        {
            BoardCalculator calculator = new BoardCalculator();

            var newBoard = calculator.PerformStep(board);

            return(Ok(newBoard));
        }
Example #2
0
        public void TestOverCrowding()
        {
            int[,] board = new int[, ] {
                { 1, 1, 1, 0, 0 },
                { 1, 1, 0, 0, 0 },
                { 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0 }
            };

            int[,] newGeneration = new int[, ] {
                { 1, 0, 1, 0, 0 },
                { 1, 0, 1, 0, 0 },
                { 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0 }
            };

            BoardCalculator steps = new BoardCalculator();

            var stepResult = steps.PerformStep(board);

            Assert.IsTrue(newGeneration.Cast <int>().SequenceEqual(stepResult.Cast <int>()));
        }