public async Task ShouldNotFindUser() { await using (var context = new DbContextFactory().CreateContext()) { var service = new UserServiceFactory().Create(context); FluentActions.Invoking(async() => await service.UpdateThemePreference(Guid.NewGuid(), true)) .Should().Throw <UserNotFoundException>(); } }
public async Task ShouldUpdate() { await using (var context = new DbContextFactory().CreateContext()) { var service = new UserServiceFactory().Create(context); var result = await service.UpdateThemePreference(ValidUserId, true); result.Should().Be(true); var check = (await context.Users.FirstOrDefaultAsync(x => x.Id == ValidUserId)).IsDarkMode; check.Should().Be(true); } }