Exemple #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);
        }
Exemple #2
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));
        }
Exemple #3
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);
        }