public void AuthenticateShouldLogInAUser()
        {
            var options = new DbContextOptionsBuilder <TasksDbContext>()
                          .UseInMemoryDatabase(databaseName: nameof(AuthenticateShouldLogInAUser))
                          .Options;

            using (var context = new TasksDbContext(options))
            {
                var usersService = new UsersService(context, config);
                var added        = new LabIV.DTO.RegisterPostDTO

                {
                    FirstName = "Julia",
                    LastName  = "Bush",
                    Username  = "******",
                    Email     = "*****@*****.**",
                    Password  = "******"
                };
                var result        = usersService.Register(added);
                var authenticated = new LabIV.DTO.LoginPostDTO
                {
                    Username = "******",
                    Password = "******"
                };
                var authresult = usersService.Authenticate(added.Username, added.Password);

                Assert.IsNotNull(authresult);
                Assert.AreEqual(1, authresult.Id);
                Assert.AreEqual(authenticated.Username, authresult.Username);
            }
        }
        public void AuthenticateShouldLogInAUser()
        {
            var options = new DbContextOptionsBuilder <TasksDbContext>()
                          .UseInMemoryDatabase(databaseName: nameof(AuthenticateShouldLogInAUser))
                          .Options;

            using (var context = new TasksDbContext(options))
            {
                var validator           = new RegisterValidator();
                var validatorUser       = new UserRoleValidator();
                var userUserRoleService = new UserUserRolesService(validatorUser, context);
                var usersService        = new UsersService(context, validator, null, userUserRoleService, config);

                UserRole addUserRoleRegular = new UserRole
                {
                    Name        = "Regular",
                    Description = "For testing..."
                };
                context.UserRoles.Add(addUserRoleRegular);
                context.SaveChanges();


                var added = new LabIV.DTO.RegisterPostDTO

                {
                    FirstName = "Julia",
                    LastName  = "Bush",
                    Username  = "******",
                    Email     = "*****@*****.**",
                    Password  = "******"
                };
                var result        = usersService.Register(added);
                var authenticated = new LabIV.DTO.LoginPostDTO
                {
                    Username = "******",
                    Password = "******"
                };
                var authresult = usersService.Authenticate(added.Username, added.Password);

                Assert.IsNotNull(authresult);
                Assert.AreEqual(1, authresult.Id);
                Assert.AreEqual(authenticated.Username, authresult.Username);
            }
        }