Пример #1
0
        public void ValidChess960SetUp()
        {
            var inputProvider           = new MockInputProvider();
            var standardTwoPlayerEngine = new StandardTwoPlayerEngine(renderer, inputProvider, testing);

            standardTwoPlayerEngine.Initialize(gameInitializationStrategy, true);

            PrivateObject chessEngine = new PrivateObject(standardTwoPlayerEngine);
            IBoard        board       = chessEngine.GetField("board") as Board;

            for (int i = (int)'a'; i <= (int)'h'; i++)
            {
                var figure = board.GetFigureAtPosition(Position.FromChessCoordinates(2, (char)i));
                Assert.IsTrue(figure.GetType() == typeof(Pawn));
            }

            List <Type> boardPieces = new List <Type>();

            for (int i = (int)'a'; i <= (int)'h'; i++)
            {
                var figure = board.GetFigureAtPosition(Position.FromChessCoordinates(1, (char)i));
                boardPieces.Add(figure.GetType());
            }


            var same = true;

            for (int i = 0; i < boardPieces.Count; i++)
            {
                if (boardPieces[i] != normalChessPieceOrder[i])
                {
                    same = false;
                    break;
                }
            }

            Assert.IsFalse(same);
        }
Пример #2
0
        public void ShouldCallParsingForEachPageFromPreviousIteration()
        {
            IInputProvider         inputProvider         = new MockInputProvider();
            IOutputProvider        outputProvider        = new MockOutputProvider();
            IStorageProvider       storageProvider       = new MockStorageProvider();
            IClientProvider        clientProvider        = new MockClientProvider();
            IPageProvider          pageProvider          = new MockPageProvider();
            ILinkProcessorProvider linkProcessorProvider = new MockLinkProcessorProvider(outputProvider, storageProvider);
            IPageParserProvider    pageParserProvider    = new MockPageParcerProvider();

            WebPageProcessor wpp = new WebPageProcessor(storageProvider, inputProvider, outputProvider, pageProvider, linkProcessorProvider, pageParserProvider, 0);

            wpp.ProcessWebPage("Test", 0);

            Assert.IsTrue(storageProvider.Contains("Test1processed"));
            Assert.IsTrue(storageProvider.Contains("Test2processed"));
            Assert.IsTrue(storageProvider.Contains("Test3processed"));
            Assert.IsTrue(storageProvider.Contains("Test4processed"));
            Assert.IsTrue(storageProvider.Contains("Test5processed"));
            Assert.IsTrue(storageProvider.Contains("Test6processed"));
            Assert.IsTrue(storageProvider.Contains("Test7processed"));
            Assert.IsTrue(storageProvider.Contains("Test8processed"));
        }
Пример #3
0
        public void ValidChessSetUp()
        {
            var inputProvider           = new MockInputProvider();
            var standardTwoPlayerEngine = new StandardTwoPlayerEngine(renderer, inputProvider, testing);

            standardTwoPlayerEngine.Initialize(gameInitializationStrategy, false);

            PrivateObject chessEngine = new PrivateObject(standardTwoPlayerEngine);
            IBoard        board       = chessEngine.GetField("board") as Board;

            for (int i = (int)'a'; i <= (int)'h'; i++)
            {
                var figure = board.GetFigureAtPosition(Position.FromChessCoordinates(2, (char)i));
                Assert.IsTrue(figure.GetType() == typeof(Pawn));
            }

            int index = 0;

            for (int i = (int)'a'; i <= (int)'h'; i++)
            {
                var figure = board.GetFigureAtPosition(Position.FromChessCoordinates(1, (char)i));
                Assert.IsTrue(figure.GetType() == chessPiecesCorrectOrder[index++]);
            }
        }