Beispiel #1
0
        public void LoadNewGame_ShouldLoadTest2DGame_GivenLoadFileArgument()
        {
            var loaderFactory = new Mock <ILoaderFactory>();

            loaderFactory.Setup(x => x.CreateNewGameLoader(It.IsAny <Type>())).Returns(new TwoDimensionalNewGameLoader());

            var newGameProvider = new LocalNewGameProvider(loaderFactory.Object);

            var args = new Arguments()
            {
                DefaultDimensions = new List <int>(),
                LoadFileName      = "test2D.nlife"
            };

            var gameState = newGameProvider.LoadNewGame(args);

            Assert.True(gameState.Board.GetDimensions()[0] == 3);
            Assert.True(gameState.Board.GetDimensions()[1] == 2);
        }
Beispiel #2
0
        public void LoadNewGame_ShouldLoad2DRandomDefaultGame_GivenDefault2DArguments()
        {
            var loaderFactory = new Mock <ILoaderFactory>();

            loaderFactory.Setup(x => x.CreateNewGameLoader(It.IsAny <Type>())).Returns(new TwoDimensionalNewGameLoader());

            var newGameProvider = new LocalNewGameProvider(loaderFactory.Object);

            var args = new Arguments()
            {
                DefaultDimensions = new List <int>()
                {
                    10, 9
                }
            };

            var gameState = newGameProvider.LoadNewGame(args);

            Assert.True(gameState.Board.GetDimensions()[0] == 10);
            Assert.True(gameState.Board.GetDimensions()[1] == 9);
        }