public void BrowseProblemsTest() { var num1 = _problemService.BrowseProblems(0, out _).Count(); _problemService.Create(new Problem { Name = "xxx" }); _problemService.Create(new Problem { Name = "xxx" }); _problemService.Create(new Problem { Name = "xxx" }); var num2 = _problemService.BrowseProblems(0, out _).Count(); Assert.Equal(num1 + 3, num2); }
public OkObjectResult Browse( [FromQuery] string tags = null, [FromQuery] int page = 1, [FromQuery] string query = null, [FromQuery] bool newest = false ) { var problems = _problemService.BrowseProblems(page, out var totalPages, tags, query, newest); return(new OkObjectResult(new { page, totalPages, problems })); }