public void RegisterTest()
        {
            UserService    target = CreateNewUserService();
            UserRegisterSP p      = new UserRegisterSP();

            p.UserName        = TestUtils.RandomUtils.RandomUserName();
            p.FirstName       = TestUtils.RandomUtils.RandomString(100);
            p.LastName        = TestUtils.RandomUtils.RandomString(100);
            p.Password        = TestUtils.RandomUtils.RandomString(64);
            p.ConfirmPassword = p.Password;
            p.Email           = TestUtils.RandomUtils.RandomEmail();
            p.PhoneNumber     = TestUtils.RandomUtils.RandomPhoneNumber();
            //p.membershipAreaID = 0;
            p.DefaultRoleID = (long)EntityEnums.RoleEnum.Patient;
            target.Register(p);

            User u = (User)target.GetByUserNameT(p.UserName);

            Assert.AreEqual(p.UserName.ToLower(), u.UserName);
            Assert.AreEqual(p.Email.ToLower(), u.Email);

            UserInRoleService uInRoleService = (UserInRoleService)EntityFactory.GetEntityServiceByName(vUserInRole.EntityName, "");
            var count = uInRoleService.GetCount(new FilterExpression(new Filter(vUserInRole.ColumnNames.UserID, u.UserID)));

            Assert.AreEqual(1, count, "UserInRole should have 1 default role");  // we expect that user be in one of the assigned roles

            TestUtils.Access.SetPrivateStaticField(typeof(FWUtils), "_SecurityUtils", new SecurityUtilsFake(u.UserID));

            var ulService = User_LanguageEN.GetService();
            var count2    = uInRoleService.GetCount(new FilterExpression(new Filter(vUser_Language.ColumnNames.UserID, u.UserID)));

            Assert.AreEqual(1, count2, "User_Language should have 1 default language"); // we expect that user be in one of the assigned roles
        }
Esempio n. 2
0
        //private const string url =

        public override string Check(User userInfo)
        {
            var service = User_LanguageEN.GetService("");

            if (service.GetCount(new FilterExpression(vUser_Language.ColumnNames.UserID, userInfo.UserID)) >= 1)
            {
                return(null);
            }
            else
            {
                return("Register/User_Language");
            }
        }