Пример #1
0
        public ActionResult Range(string first, string last)
        {
            if (string.IsNullOrEmpty(first))
            {
                first = "1";
            }

            if (string.IsNullOrEmpty(last))
            {
                last = "100";
            }

            var api = new BoardGameRank();

            var result =
                 api.GetRank((short.Parse(first)), short.Parse(last)).Select(b => new BoardGameDto()
                 {
                     Name = b.Name,
                     Rank = b.Rank,
                     Year = b.Year,
                     ImgUrl = b.ImageUrl,
                     GameUrl = b.GameUrl
                 });

            return View("Index", new BoardGameModel
            {
                BoardGameCollection = result,
                FirstRank = short.Parse(first),
                LastRank = short.Parse(last)
            });
        }
Пример #2
0
        public void Get_Main_Page_Rank_Test()
        {
            var api = new BoardGameRank();

            var result = api.GetRank(1, 100);

            Assert.Equal(100, result.Count());
        }
Пример #3
0
        public void Get_Range_Rank_Test(short first, short last)
        {
            var api = new BoardGameRank();

            var result = api.GetRank((short)first, (short)last);

            Assert.Equal(first, result.First().Rank);

            Assert.Equal(last, result.Last().Rank);
        }
Пример #4
0
        public void Get_Board_Game_Dto_Data_Test()
        {
            var api = new BoardGameRank();

            var result = api.GetRank(1, 200).FirstOrDefault();

            Assert.NotEmpty(result.Name);
            Assert.NotEmpty(result.Year);
            Assert.NotEmpty(result.ImageUrl);
            Assert.NotEmpty(result.GameUrl);
            Assert.Equal(1, result.Rank);
        }
Пример #5
0
        // GET: Explore
        public ActionResult Index()
        {
            var api = new BoardGameRank();

            var result =
                api.GetRank(1, 100).Select(b => new BoardGameDto()
                {
                    Name = b.Name,
                    Rank = b.Rank,
                    Year = b.Year,
                    ImgUrl = b.ImageUrl,
                    GameUrl = b.GameUrl
                });

            return View( new BoardGameModel
            {
                BoardGameCollection = result,
                FirstRank = 1,
                LastRank = 100
            });
        }