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) }); }
public void Get_Main_Page_Rank_Test() { var api = new BoardGameRank(); var result = api.GetRank(1, 100); Assert.Equal(100, result.Count()); }
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); }
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); }
// 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 }); }