public static Fr8AccountDO TestDockyardAccount7()
        {
            string adminUserEmail = "*****@*****.**";
            string password       = "******";
            string firstName      = "Admin";
            string lastName       = "Admin";

            Fr8Account _dockyardAccount = ObjectFactory.GetInstance <Fr8Account>();

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var adminRoleId = Guid.NewGuid().ToString();
                var adminRoleDO = new AspNetRolesDO()
                {
                    Name        = "Admin",
                    Id          = adminRoleId,
                    CreateDate  = DateTimeOffset.UtcNow,
                    LastUpdated = DateTimeOffset.UtcNow,
                };
                uow.AspNetRolesRepository.Add(adminRoleDO);
                var adminUserFr8Account = _dockyardAccount.Register(uow, adminUserEmail, firstName, lastName, password, adminRoleId);
                uow.AspNetUserRolesRepository.RevokeRoleFromUser(Roles.Admin, adminUserFr8Account.Id);
                var adminRole = new IdentityUserRole()
                {
                    RoleId = adminRoleId, UserId = adminUserFr8Account.Id
                };
                adminUserFr8Account.Roles.Add(adminRole);
                uow.SaveChanges();
                return(adminUserFr8Account);
            }
        }
Ejemplo n.º 2
0
 public void CanRegisterOrNot()
 {
     using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
     {
         var curDockyardAccount = _fr8Account.Register(uow, userName, "Alex", "Lucre", password, Roles.Admin);
         Assert.IsNotNull(curDockyardAccount);
         Assert.AreEqual(curDockyardAccount.UserName, userName);
     }
 }
        public static Fr8AccountDO TestDockyardAccount3()
        {
            Fr8Account _dockyardAccount = ObjectFactory.GetInstance <Fr8Account>();

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                return(_dockyardAccount.Register(uow, "alexlucre", "Alex", "Lucre1", "alex@123", Roles.Admin));
            }
        }
        public static Fr8AccountDO TestDockyardAccount6()
        {
            string guestUserEmail = "*****@*****.**";
            string password       = "******";
            string firstName      = " Guest";
            string lastName       = " User";

            Fr8Account _dockyardAccount = ObjectFactory.GetInstance <Fr8Account>();

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var guestUserFr8Account = _dockyardAccount.Register(uow, guestUserEmail, firstName, lastName, password, Roles.Guest);
                uow.AspNetUserRolesRepository.RevokeRoleFromUser(Roles.StandardUser, guestUserFr8Account.Id);
                uow.SaveChanges();

                return(guestUserFr8Account);
            }
        }