public void TestGetUserByUserName()
        {
            // given:
            ProposedUser user = ProposedUserCreator.CreateProposedUser();
            // when:
            ProposedUser actualUser = ProposedUserDao.FindByUserName(user.UserName);

            // then:
            Assert.AreEqual(user, actualUser);
        }
        public void TestGetUserByBusinessId()
        {
            // given:
            ProposedUser user = ProposedUserCreator.CreateProposedUser();
            // when:
            ProposedUser actualUser = ProposedUserDao.GetByBusinessId(user.BusinessId);

            // then:
            Assert.AreEqual(user, actualUser);
        }
        public void TestDeleteUser()
        {
            //given:
            ProposedUser user = ProposedUserCreator.CreateProposedUser();
            // when:
            ProposedUser actualUser = ProposedUserDao.Get(user.Id);

            ProposedUserDao.Delete(actualUser);
            ProposedUserDao.FlushAndClear();

            // then: Exception
            Assert.Throws <ObjectNotFoundException>(() => ProposedUserDao.Get(user.Id));
        }
        public void TestUpdateProposedUser()
        {
            ProposedUser user         = ProposedUserCreator.CreateProposedUser();
            ProposedUser userToUpdate = ProposedUserDao.Get(user.Id);

            ProposedUserDataDto proposedUserDataDto = ProposedUserCreator.CreateProposedUserDataDto("neuerVorname", "neuerNachname", Salutation.Mister, "titel", new DateTime(1990, 09, 09));

            ProposedUserContactDto proposedUserContactDto = ProposedUserCreator.CreateProposedUserContactDto("*****@*****.**",
                                                                                                             "Nürnberger Eieruhren GmbH", "Nürnberger Ei", "0", "01067", "Dresden", Country.DE,
                                                                                                             "http://www.nuernberger-eier.de", "phone", "privat", "mobile", "fax");

            userToUpdate.Update(userToUpdate.UserName, proposedUserDataDto, proposedUserContactDto, new EntityChangedDto(UserCreator.Create(), DateTime.Now));

            ProposedUserDao.FlushAndClear();

            ProposedUser actualUser = ProposedUserDao.Get(userToUpdate.Id);

            DtoAssert.AreEqual(proposedUserDataDto, actualUser.GetUserDataDto());
            DtoAssert.AreEqual(proposedUserContactDto, actualUser.GetUserContactDto());
        }