public void TryBuildTest(string dataFolder, long heroId, bool isStringEnum)
        {
            var jsonTestData = GetJsonFileFromFolder(dataFolder, isStringEnum);

            var handBuilder = new HandBuilder();

            var         result = false;
            HandHistory actual = null;

            foreach (var gameRoomStateChange in jsonTestData.GameRoomStateChanges)
            {
                var res = JsonConvert.SerializeObject(gameRoomStateChange, new StringEnumConverter());

                foreach (var c in gameRoomStateChange.GameRoomInfo.UserGameInfos)
                {
                    if (!c.IsActive)
                    {
                        continue;
                    }

                    Console.WriteLine($"{c.GameState}, {c.UserInfo.Nick}: {DateTimeHelper.UnixTimeToDateTime(c.ActTime / 1000)}");
                }

                result = handBuilder.TryBuild(gameRoomStateChange, heroId, out actual);

                if (result)
                {
                    break;
                }
            }

            Assert.IsTrue(result, "Result must be true");
            Assert.IsNotNull(actual, "Hand history must be built as a result.");

            AssertionUtils.AssertHandHistory(actual, jsonTestData.ExpectedResult);
        }
Exemple #2
0
 public HandBuilderTests()
 {
     this.handBuilder = new HandBuilder();
 }
Exemple #3
0
 public DuelistBuilder WithHand(HandBuilder handBuilder)
 {
     this.hand = handBuilder.Build();
     return(this);
 }