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 }
public void RegisterQuickTest() { UserService target = CreateNewUserService(); UserRegisterQuickFromDoctorSP p = new UserRegisterQuickFromDoctorSP(); p.FirstName = TestUtils.RandomUtils.RandomString(100); p.LastName = TestUtils.RandomUtils.RandomString(100); p.PhoneNumber = TestUtils.RandomUtils.RandomPhoneNumber(); p.ReferrerUserID = (long)TestEnums.User.constDoctorID; User insertedUser = (User)target.RegisterQuickFromDoctor(p); string phoneNumberSearchable = PhoneNumberUtils.MakeSearchablePhoneNumber(p.PhoneNumber); User u = (User)target.GetByUserNameT(insertedUser.UserName); Assert.AreEqual(insertedUser.UserName.ToLower(), u.UserName, "User name didn't inserted correctly"); //Assert.AreEqual(phoneNumberSearchable, u.PhoneNumberSearchable, "phoneNumber didn't inserted correctly"); UserInRoleService uInRoleService = (UserInRoleService)EntityFactory.GetEntityServiceByName(vUserInRole.EntityName, ""); var count = uInRoleService.GetCount(new FilterExpression(new Filter(vUserInRole.ColumnNames.UserID, u.UserID))); Assert.AreEqual(1, count, "we expect that user be in one of the assigned roles"); // we expect that user be in one of the assigned roles IDoctor_PatientService doctor_PatientService = Doctor_PatientEN.GetService(); FilterExpression filter = new FilterExpression(vDoctor_Patient.ColumnNames.DoctorID, p.ReferrerUserID); filter.AddFilter(vDoctor_Patient.ColumnNames.PatientUserID, u.UserID); Assert.AreEqual(1, doctor_PatientService.GetCount(filter), "Doctor_Patient is not exists."); }