Ejemplo n.º 1
0
        public void Format_should_format_move_text()
        {
            var sut    = new MoveTextFormatter();
            var entry1 =
                new HalfMoveEntry(new Move
            {
                Type         = MoveType.Capture,
                Piece        = PieceType.Knight,
                TargetSquare = new Square(File.E, 5),
                Annotation   = MoveAnnotation.Good
            })
            {
                MoveNumber = 37
            };

            var entry2 = new NAGEntry(13);

            var rav1 = new CommentEntry("comment");
            var rav2 =
                new HalfMoveEntry(new Move
            {
                Type         = MoveType.Simple,
                Piece        = PieceType.Knight,
                TargetSquare = new Square(File.E, 3),
                Annotation   = MoveAnnotation.Blunder
            })
            {
                MoveNumber = 37
            };

            var entry3 = new RAVEntry(new MoveTextEntryList {
                rav1, rav2
            });

            var entry4 =
                new HalfMoveEntry(new Move
            {
                Type         = MoveType.Simple,
                Piece        = PieceType.Rook,
                TargetSquare = new Square(File.D, 8)
            })
            {
                MoveNumber = 37, IsContinued = true
            };

            var entry5 = new MovePairEntry(
                new Move {
                Type = MoveType.Simple, TargetSquare = new Square(File.H, 4)
            },
                new Move {
                Type = MoveType.Simple, Piece = PieceType.Rook, TargetSquare = new Square(File.D, 5)
            })
            {
                MoveNumber = 38
            };

            var entry6 = new GameEndEntry(GameResult.Draw);
            var entry7 = new CommentEntry("game ends in draw, whooot");

            var moveText = new List <MoveTextEntry> {
                entry1, entry2, entry3, entry4, entry5, entry6, entry7
            };

            Assert.AreEqual("37. Nxe5! $13 ({comment} 37. Ne3??) 37... Rd8 38. h4 Rd5 ½-½ {game ends in draw, whooot}", sut.Format(moveText));
        }
Ejemplo n.º 2
0
        public void Format_should_format_move_text()
        {
            var sut = new MoveTextFormatter();
            var entry1 =
                new HalfMoveEntry(new Move
                    {
                        Type = MoveType.Capture,
                        Piece = PieceType.Knight,
                        TargetSquare = new Square(File.E, 5),
                        Annotation = MoveAnnotation.Good
                    }) { MoveNumber = 37 };

            var entry2 = new NAGEntry(13);

            var rav1 = new CommentEntry("comment");
            var rav2 =
                new HalfMoveEntry(new Move
                    {
                        Type = MoveType.Simple,
                        Piece = PieceType.Knight,
                        TargetSquare = new Square(File.E, 3),
                        Annotation = MoveAnnotation.Blunder
                    }) { MoveNumber = 37 };

            var entry3 = new RAVEntry(new MoveTextEntryList { rav1, rav2 });

            var entry4 =
                new HalfMoveEntry(new Move
                    {
                        Type = MoveType.Simple,
                        Piece = PieceType.Rook,
                        TargetSquare = new Square(File.D, 8)
                    }) { MoveNumber = 37, IsContinued = true };

            var entry5 = new MovePairEntry(
                new Move { Type = MoveType.Simple, TargetSquare = new Square(File.H, 4) },
                new Move { Type = MoveType.Simple, Piece = PieceType.Rook, TargetSquare = new Square(File.D, 5) }) { MoveNumber = 38 };

            var entry6 = new GameEndEntry(GameResult.Draw);
            var entry7 = new CommentEntry("game ends in draw, whooot");

            var moveText = new List<MoveTextEntry> { entry1, entry2, entry3, entry4, entry5, entry6, entry7 };

            Assert.AreEqual("37. Nxe5! $13 ({comment} 37. Ne3??) 37... Rd8 38. h4 Rd5 ½-½ {game ends in draw, whooot}", sut.Format(moveText));
        }