コード例 #1
0
        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));
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        public void TestSaveAndLoad()
        {
            // given :
            UserGroup              userGroup              = UserGroupCreator.Create();
            ProposedUserDataDto    proposedUserDataDto    = new ProposedUserDataDto("Beantragter", "Nutzer", "Prof. Dr.", Salutation.Mister, new DateTime(2000, 2, 20));
            ProposedUserContactDto proposedUserContactDto = new ProposedUserContactDto("*****@*****.**", "Straße", "1", "01234", "Stadt", Country.DE, "queo", "http://www.queo.de", "0123-456789", "0123-0123456", "0151-123456");
            EntityCreatedDto       entityCreatedDto       = new EntityCreatedDto(UserCreator.Create(), new DateTime(2017, 01, 01, 01, 01, 01));
            ProposedUser           user = new ProposedUser("proposedUser", proposedUserDataDto, proposedUserContactDto, entityCreatedDto);

            // when:
            ProposedUserDao.Save(user);
            ProposedUserDao.FlushAndClear();
            ProposedUser actualUser = ProposedUserDao.Get(user.Id);

            // then:
            Assert.AreEqual(user, actualUser);
            actualUser.GetUserContactDto().Should().Be(proposedUserContactDto);
            actualUser.GetUserDataDto().Should().Be(proposedUserDataDto);
            actualUser.CreatedAt.Should().Be(entityCreatedDto.CreatedAt);
            actualUser.CreatedBy.Should().Be(entityCreatedDto.CreatedBy);
            actualUser.ChangedBy.Should().BeNull();
            actualUser.ChangedAt.Should().NotHaveValue();
        }