public async Task GetAll_Valid_Success() { DateTime dtStart = DateTime.Now; await ExecuteWithDb((db) => { var handler = new GroupQueryHandler( MockMediator.Object, db, Mapper, MockAuthorizationService.Object); return(handler.Handle(new GetAllGroupsQuery(), default(CancellationToken))); }, (result, db) => { result.Should().NotBeNull(); result.Should().BeAssignableTo <IEnumerable <GroupDto> >(); result.Should().HaveCountGreaterThan(0); foreach (var group in result) { group.Id.Should().BeGreaterThan(0); group.Name.Should().NotBeNullOrWhiteSpace(); group.CreatedDate.Should().BeOnOrAfter(dtStart); group.UpdatedDate.Should().BeOnOrAfter(dtStart); } }); }
public async Task GetById_IdNotFound_EntityNotFoundException(int id) { await ExecuteWithDb((db) => { var handler = new GroupQueryHandler( MockMediator.Object, db, Mapper, MockAuthorizationService.Object); return(handler.Handle(new GetGroupByIdQuery() { GroupId = id }, default(CancellationToken))); }); }