Esempio n. 1
0
        public TestFixture()
        {
            FakeReader = Substitute.For <IReadPgnFiles>();
            FakeWriter = Substitute.For <IWritePgnFiles>();
            FakeRepo   = Substitute.For <IGameRepository>();
            FakeLogger = Substitute.For <ILogger>();

            PgnWithAtLeast15Moves = new Pgn();
            PgnWithAtLeast15Moves.Add("1.e4 e5 2.Bc4 Bc5 3.c3 Nf6 4.d4 exd4 5.cxd4 Bb6 6.Nc3 O-O 7.Nge2 c6 8.Bd3 d5 9.e5 Ne8 10.Be3 f6 11.Qd2 fxe5 12.dxe5 Be6 13.Nf4 Qe7 14.Bxb6 axb6 15.O-O Nd7");

            PgnWithLessThan15Moves = new Pgn();
            PgnWithLessThan15Moves.Add("1.e4 e5 2.Bc4 Bc5 3.c3 Nf6 4.d4 exd4 5.cxd4 Bb6 6.Nc3 O-O 7.Nge2 c6 8.Bd3 d5");
        }
Esempio n. 2
0
        public Game(IMetadata metadata, IPgn pgn)
        {
            Moves = pgn.Moves;

            // Adding PlyCount
            if (!metadata.Values.Any(tag => tag.Contains("[PlyCount ")))
            {
                metadata.Values.Add($"[PlyCount \"{PlyCount}\"]");
            }

            Metadata = string.Join(Environment.NewLine, metadata.Values);

            foreach (var tagPair in metadata.Values)
            {
                SetupTagPair(tagPair);
            }

            Hash = Sha256Service.GetHash(Moves);
        }