public async Task ShouldNotFindUser() { await using (var context = new DbContextFactory().CreateContext()) { var service = new UserServiceFactory().Create(context); FluentActions.Invoking(async() => await service.Destroy(Guid.NewGuid())) .Should().Throw <UserNotFoundException>(); } }
public async Task ShouldDestroyUser() { await using (var context = new DbContextFactory().CreateContext()) { var service = new UserServiceFactory().Create(context); var id = new Guid("046E876E-D413-45AF-AC2A-552D7AA46C5C"); await service.Destroy(id); var result = await context.Users.FirstOrDefaultAsync(x => x.Id == id); result.Should().BeNull(); } }