public async Task BookApplicationService_Get_with_error_at_serach() { var filter = new Filter { Search = null, CurrentPage = 0, ItemsPerPage = 10 }; var model = await _bookApplicationService.Get(filter); DomainNotificationHandler.HasNotifications().Should().BeTrue(); DomainNotificationHandler.GetNotifications.First().Value.Should().Be(DomainError.searchIsRequired); model.Items.Should().HaveCount(0); model.TotalItems.Should().Be(0); filter = new Filter { Search = "te", CurrentPage = 0, ItemsPerPage = 10 }; model = await _bookApplicationService.Get(filter); DomainNotificationHandler.HasNotifications().Should().BeTrue(); DomainNotificationHandler.GetNotifications[1].Value.Should().Be(string.Format(DomainError.SearchMustBeAtLeastCharacters, 3)); model.Items.Should().HaveCount(0); model.TotalItems.Should().Be(0); }
public async Task <IActionResult> Get([FromQuery] Filter filter) { var result = await _bookApplicationService.Get(filter); return(Response(result)); }