Esempio n. 1
0
        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>();
            }
        }
Esempio n. 2
0
        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);
            }
        }