示例#1
0
        public void BlackElo_tag_name_is_case_insensitive()
        {
            var pgnGame = new PgnGameBuilder()
                          .WithCustomTag("BlaCkELO", "1234")
                          .Build();

            var actual = _mapper.Map <PgnImport>(pgnGame);

            actual.BlackElo.ShouldBe("1234");
        }
示例#2
0
        public void ECO_tag_name_is_case_insensitive()
        {
            var pgnGame = new PgnGameBuilder()
                          .WithCustomTag("eCo", "D04")
                          .Build();

            var actual = _mapper.Map <PgnImport>(pgnGame);

            actual.Eco.ShouldBe("D04");
        }
示例#3
0
        public void Partial_dates_are_handled()
        {
            var pgnGame = new PgnGameBuilder()
                          .WithYear("??")
                          .WithMonth("??")
                          .WithDay("??")
                          .Build();

            var actual = _mapper.Map <PgnImport>(pgnGame);

            actual.Date.ShouldBe("????.??.??");
        }
示例#4
0
        public void CustomTags_are_stored()
        {
            var pgnGame = new PgnGameBuilder()
                          .WithCustomTag("Custom", "value")
                          .Build();

            var actual = _mapper.Map <PgnImport>(pgnGame);

            var customTags = JsonSerializer.Deserialize <Dictionary <string, string> >(actual.CustomTagsJson);

            customTags.ContainsKey("Custom").ShouldBeTrue();
            customTags["Custom"].ShouldBe("value");
        }
示例#5
0
        public void ECO_and_ELO_values_are_explicitly_mapped()
        {
            var pgnGame = new PgnGameBuilder()
                          .WithEco("C03")
                          .WithWhiteElo(1111)
                          .WithBlackElo(2222)
                          .Build();

            var actual = _mapper.Map <PgnImport>(pgnGame);

            actual.Eco.ShouldBe("C03");
            actual.WhiteElo.ShouldBe("1111");
            actual.BlackElo.ShouldBe("2222");
            actual.CustomTagsJson.ShouldBeNull();
        }
示例#6
0
        public void Valid_Pgn_IsMapped()
        {
            var pgnGame = new PgnGameBuilder().Build();

            var actual = _mapper.Map <PgnImport>(pgnGame);

            actual.Site.ShouldBe(pgnGame.Site);
            actual.Event.ShouldBe(pgnGame.Event);
            actual.Result.ShouldBe(pgnGame.Result.RevertToText());
            actual.Round.ShouldBe(pgnGame.Round);
            actual.Black.ShouldBe(pgnGame.Black);
            actual.White.ShouldBe(pgnGame.White);
            actual.Date.ShouldBe(pgnGame.Date.RevertDateToText());
            actual.MoveList.ShouldBe(pgnGame.NormaliseMoveText());
        }