Пример #1
0
        public async Task ShouldNotFindUser()
        {
            await using (var context = new DbContextFactory().CreateContext())
            {
                var service = new AuthServiceFactory().Create(context);

                FluentActions.Invoking(async() => await service.UpdatePassword(Guid.Empty, "wrong"))
                .Should().Throw <UserNotFoundException>();
            }
        }
Пример #2
0
        public async Task ShouldUpdatePassword()
        {
            await using (var context = new DbContextFactory().CreateContext())
            {
                var service = new AuthServiceFactory().Create(context);

                Guid id = new Guid("046E876E-D413-45AF-AC2A-552D7AA46C5C");

                var user = await context.Users.FirstOrDefaultAsync(x => x.Id == id);

                var prevPassword = user.Password;

                await service.UpdatePassword(id, "NewPassword");

                user.Password.Should().NotBe(prevPassword);
            }
        }