public void EditUserPersonalData()
        {
            IList<UserAccount> accounts = new List<UserAccount>();
            NMock.Actions.InvokeAction saveUser = new NMock.Actions.InvokeAction(new Action(() => accounts.Add(userAccount)));
            accountAdministrationDaoMock.Expects.Any.MethodWith(x => x.SaveOrUpdateUser(userAccount)).Will(saveUser);
            accountAdministrationServiceMock.Expects.Any.MethodWith(x => x.SaveOrUpdateUser(userAccount)).Will(saveUser);

            userInformationServiceMock.Expects.Any.MethodWith(x => x.GetUserAccountById(userAccount.Id)).WillReturn(userAccount);
            userInformationDaoMock.Expects.Any.MethodWith(x => x.GetUserAccountById(userAccount.Id)).WillReturn(userAccount);

            PersonalData testPersonalData = new PersonalData();
            testPersonalData.FirstName = AuthorizationTestData.EDIT_FIRST_NAME;
            testPersonalData.LastName = AuthorizationTestData.EDIT_LAST_NAME;
            testPersonalData.PESEL = AuthorizationTestData.EDIT_PESEL;
            testPersonalData.PhoneNumber = AuthorizationTestData.EDIT_PHONE_NUMBER;
            testPersonalData.Address = new Address();
            testPersonalData.Address.Street = AuthorizationTestData.EDIT_ADDRESS_STREET;
            testPersonalData.Address.PostalCode = AuthorizationTestData.EDIT_ADDRESS_POSTAL_CODE;
            testPersonalData.Address.City = AuthorizationTestData.EDIT_ADDRESS_CITY;
            testPersonalData.Address.Country = AuthorizationTestData.EDIT_ADDRESS_COUNTRY;

            managementService.EditUserPersonalData(userAccountId, testPersonalData);

            UserAccount userAccount2 = userInformationService.GetUserAccountById(userAccountId);
            PersonalData personalData = userAccount2.PersonalData;

            Assert.AreEqual(personalData.FirstName, testPersonalData.FirstName);
            Assert.AreEqual(personalData.LastName, testPersonalData.LastName);
            Assert.AreEqual(personalData.PESEL, testPersonalData.PESEL);
            Assert.AreEqual(personalData.PhoneNumber, testPersonalData.PhoneNumber);
            Assert.AreEqual(personalData.Address.Street, testPersonalData.Address.Street);
            Assert.AreEqual(personalData.Address.PostalCode, testPersonalData.Address.PostalCode);
            Assert.AreEqual(personalData.Address.City, testPersonalData.Address.City);
            Assert.AreEqual(personalData.Address.Country, testPersonalData.Address.Country);
        }
Exemple #2
0
 public PersonalData PersonalDataHelper()
 {
     PersonalData testPersonalData = new PersonalData();
     testPersonalData.FirstName = AuthorizationTestData.FIRST_NAME;
     testPersonalData.LastName = AuthorizationTestData.LAST_NAME;
     testPersonalData.PESEL = AuthorizationTestData.PESEL;
     testPersonalData.PhoneNumber = AuthorizationTestData.PHONE_NUMBER;
     testPersonalData.Address = new Address();
     testPersonalData.Address.Street = AuthorizationTestData.ADDRESS_STREET;
     testPersonalData.Address.PostalCode = AuthorizationTestData.ADDRESS_POSTAL_CODE;
     testPersonalData.Address.City = AuthorizationTestData.ADDRESS_CITY;
     testPersonalData.Address.Country = AuthorizationTestData.ADDRESS_COUNTRY;
     return testPersonalData;
 }
 public void SaveNewUserPersonalData(long userAccountId, PersonalData personalData, Address address)
 {
     UserAccount userAccount = ServiceLocator.UserInformationService.GetUserAccountById(userAccountId);
     userAccount.PersonalData = personalData;
     personalData.Address = address;
     ServiceLocator.AccountAdministrationService.SaveOrUpdateUser(userAccount);
 }
        public void TestIdentityCardNumber()
        {
            UserAccount userAcc = new UserAccount();
            PersonalData personalData = new PersonalData();
            personalData.PESEL = PESEL;
            personalData.Sex = SEX;
            personalData.FirstName = firstName;
            personalData.LastName = lastName;
            personalData.IdentityCardNumber = IDCN;
            personalData.PhoneNumber = PHONE;
            userAcc.PersonalData = personalData;

            List<UserAccount> userAccounts = new List<UserAccount>();
            NMock.Actions.InvokeAction addUserAccounts = new NMock.Actions.InvokeAction(() => userAccounts.Add(userAcc));
            accountAdministrationDao.Expects.One.MethodWith(x => x.SaveOrUpdateUser(userAcc)).Will(addUserAccounts);

            aas.SaveOrUpdateUser(userAcc);
            userInformationService.Expects.One.MethodWith(x => x.GetUserAccountById(userAcc.Id)).WillReturn(userAcc);
            PersonalData returnedPD = sps.GetUserPersonalDataById(userAcc.Id);
            Assert.AreEqual(PESEL, returnedPD.PESEL);
            Assert.AreEqual(SEX, returnedPD.Sex);
            Assert.AreEqual(firstName, returnedPD.FirstName);
            Assert.AreEqual(lastName, returnedPD.LastName);
            Assert.AreEqual(IDCN, returnedPD.IdentityCardNumber);
            Assert.AreEqual(PHONE, returnedPD.PhoneNumber);
        }
 public void EditUserPersonalData(long userId, PersonalData personalData)
 {
     UserAccount userAccount = UserInformationService.GetUserAccountById(userId);
     userAccount.PersonalData.FirstName = personalData.FirstName;
     userAccount.PersonalData.LastName = personalData.LastName;
     userAccount.PersonalData.PESEL = personalData.PESEL;
     userAccount.PersonalData.PhoneNumber = personalData.PhoneNumber;
     userAccount.PersonalData.Address.Street = personalData.Address.Street;
     userAccount.PersonalData.Address.PostalCode = personalData.Address.PostalCode;
     userAccount.PersonalData.Address.City = personalData.Address.City;
     userAccount.PersonalData.Address.Country = personalData.Address.Country;
     AccountAdministrationService.SaveOrUpdateUser(userAccount);
 }