Beispiel #1
0
        public void GetMovePairs_WWWBW_ShouldReturn4Nodes()
        {
            var game = new Game();

            game.ApplyMove("c4").ApplyMove("Nf6").ApplyMove("Nc3").ApplyMove("e6");
            game.MovePrevious();
            game.MovePrevious();
            game.ApplyMove("g3");

            var pgnNode = new PgnNode(game.InitialNode.Node);
            var pairs   = pgnNode.GetMovePairs().ToArray();

            AssertMovePair(pairs[0].WhiteNode, "c4");
            AssertMovePair(pairs[0].BlackNode, "Nf6");
            AssertMovePair(pairs[1].WhiteNode, "Nc3");
            AssertMovePair(pairs[1].BlackNode, null);
            AssertMovePair(pairs[2].WhiteNode, "g3");
            AssertMovePair(pairs[2].BlackNode, null);
            AssertMovePair(pairs[3].WhiteNode, null);
            AssertMovePair(pairs[3].BlackNode, "e6");
            Assert.AreEqual(4, pairs.Length);
        }
Beispiel #2
0
        public void GetMovePairs_WWB_ShouldReturn4Nodes()
        {
            var game = new Game("rnbqkb1r/pppppppp/5n2/8/2P5/2N5/PP1PPPPP/R1BQKBNR b KQkq - 2 2");

            game.ApplyMove("e6").MovePrevious();
            game.ApplyMove("e5").ApplyMove("Nf3").ExitVariation();
            game.MoveNext();
            game.ApplyMove("Nf3");

            var pgnNode = new PgnNode(game.InitialNode.Node);
            var pairs   = pgnNode.GetMovePairs().ToArray();

            AssertMovePair(pairs[0].WhiteNode, null);
            AssertMovePair(pairs[0].BlackNode, "e6");
            AssertMovePair(pairs[1].WhiteNode, null);
            AssertMovePair(pairs[1].BlackNode, "e5");
            AssertMovePair(pairs[2].WhiteNode, "Nf3");
            AssertMovePair(pairs[2].BlackNode, null);
            AssertMovePair(pairs[3].WhiteNode, "Nf3");
            AssertMovePair(pairs[3].BlackNode, null);
            Assert.AreEqual(4, pairs.Length);
        }