public async Task ShouldReturnNoMoreThanTenWebsites() { for (int i = 0; i < 15; i++) { Website website = new Website { Name = "test", Url = "test.com", CategoryId = 1, ImagePath = "not existing one", Email = "test@email", Password = "******" }; await AddAsync(website); } var query = new ListWebsitesQuery(); var result = await SendAsync(query); result.Should().NotBeNull(); result.Should().NotBeEmpty(); result.Should().HaveCountLessOrEqualTo(10); }
public async Task ShouldReturnOneWebsite() { Website website = new Website { Name = "test", Url = "test.com", CategoryId = 1, ImagePath = "not existing one", Email = "test@email", Password = "******" }; await AddAsync(website); var query = new ListWebsitesQuery(); var result = await SendAsync(query); result.Should().NotBeNull(); result.Should().NotBeEmpty(); result.Should().HaveCount(1); }
public async Task <IActionResult> List([FromQuery] ListWebsitesQuery query) { var websitesDtos = await this.Mediator.Send(query); return(this.Ok(websitesDtos)); }