Example #1
0
        public void GetArenaInfos_By_Upper_And_Lower_Range(int infoCount, int targetRank, int upperRange, int lowerRange, int expected)
        {
            var tableState =
                TableSheets.FromTableSheetsState(TableSheetsImporter.ImportTableSheets());
            var     weeklyArenaState = new WeeklyArenaState(new PrivateKey().ToAddress());
            Address targetAddress;

            for (var i = 0; i < infoCount; i++)
            {
                var avatarAddress = new PrivateKey().ToAddress();
                if (i + 1 == targetRank)
                {
                    targetAddress = avatarAddress;
                }

                var avatarState = new AvatarState(
                    avatarAddress,
                    new PrivateKey().ToAddress(),
                    0L,
                    tableState,
                    new GameConfigState(),
                    i.ToString());
                weeklyArenaState.Add(
                    new PrivateKey().ToAddress(),
                    new ArenaInfo(avatarState, tableState.CharacterSheet, true));
            }

            var arenaInfos = weeklyArenaState.GetArenaInfos(targetAddress, upperRange, lowerRange);

            Assert.Equal(expected, arenaInfos.Count);
        }
Example #2
0
 public CombinationConsumableTest()
 {
     _agentAddress  = default;
     _avatarAddress = _agentAddress.Derive("avatar");
     _slotAddress   = _avatarAddress.Derive(
         string.Format(
             CultureInfo.InvariantCulture,
             CombinationSlotState.DeriveFormat,
             0
             )
         );
     _tableSheetsState = TableSheetsImporter.ImportTableSheets();
     _tableSheets      = TableSheets.FromTableSheetsState(_tableSheetsState);
     _random           = new ItemEnhancementTest.TestRandom();
 }
Example #3
0
        public void GetArenaInfos_By_FirstRank_And_Count_Throw(int infoCount, int firstRank)
        {
            var tableState =
                TableSheets.FromTableSheetsState(TableSheetsImporter.ImportTableSheets());
            var weeklyArenaState = new WeeklyArenaState(new PrivateKey().ToAddress());

            for (var i = 0; i < infoCount; i++)
            {
                var avatarState = new AvatarState(
                    new PrivateKey().ToAddress(),
                    new PrivateKey().ToAddress(),
                    0L,
                    tableState,
                    new GameConfigState(),
                    i.ToString());
                weeklyArenaState.Add(
                    new PrivateKey().ToAddress(),
                    new ArenaInfo(avatarState, tableState.CharacterSheet, true));
            }

            Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                        weeklyArenaState.GetArenaInfos(firstRank, 100));
        }
Example #4
0
        public void GetArenaInfos_By_FirstRank_And_Count(int infoCount, int firstRank, int count, int expected)
        {
            var tableState =
                TableSheets.FromTableSheetsState(TableSheetsImporter.ImportTableSheets());
            var weeklyArenaState = new WeeklyArenaState(new PrivateKey().ToAddress());

            for (var i = 0; i < infoCount; i++)
            {
                var avatarState = new AvatarState(
                    new PrivateKey().ToAddress(),
                    new PrivateKey().ToAddress(),
                    0L,
                    tableState,
                    new GameConfigState(),
                    i.ToString());
                weeklyArenaState.Add(
                    new PrivateKey().ToAddress(),
                    new ArenaInfo(avatarState, tableState.CharacterSheet, true));
            }

            var arenaInfos = weeklyArenaState.GetArenaInfos(firstRank, count);

            Assert.Equal(expected, arenaInfos.Count);
        }
Example #5
0
 public StageSimulatorTest()
 {
     _tableSheets = TableSheets.FromTableSheetsState(TableSheetsImporter.ImportTableSheets());
     _random      = new ItemEnhancementTest.TestRandom();
     _avatarState = new AvatarState(default, default, 0, _tableSheets, new GameConfigState());
Example #6
0
 public RedeemCodeTest()
 {
     _tableSheetsState = TableSheetsImporter.ImportTableSheets();
     _tableSheets      = TableSheets.FromTableSheetsState(_tableSheetsState);
 }
Example #7
0
 public SimulatorTest()
 {
     _tableSheets = TableSheets.FromTableSheetsState(TableSheetsImporter.ImportTableSheets());
     _random      = new ItemEnhancementTest.TestRandom();
 }
Example #8
0
 public RankingBattleTest()
 {
     _tableSheetsState = TableSheetsImporter.ImportTableSheets();
 }
Example #9
0
 public ItemEnhancementTest()
 {
     _tableSheetsState = TableSheetsImporter.ImportTableSheets();
     _random           = new TestRandom();
 }