示例#1
0
        public void TestCreateAndLoadProposedUser()
        {
            // when:
            ProposedUserContactDto updatedProposedUserContactDto = ProposedUserCreator.CreateProposedUserContactDto("*****@*****.**", "Testunternehmen", "Teststraße", "?", "01234", "Teststadt",
                                                                                                                    Country.DE, "http://www.url.test", "phone", "privat", "mobile", "fax");
            ProposedUserDataDto updatedProposedUserDataDto = ProposedUserCreator.CreateProposedUserDataDto("Vorname", "Nachname", Salutation.Mister, "Titel", new DateTime(1980, 01, 02));

            EntityCreatedDto creationDto = new EntityCreatedDto(UserCreator.Create(), new DateTime(2016, 12, 12, 15, 30, 0));
            ProposedUser     user        = ProposedUserService.Create("testNutzer", updatedProposedUserDataDto, updatedProposedUserContactDto, creationDto);

            ProposedUser actualUser = ProposedUserService.GetByBusinessId(user.BusinessId);

            // then:
            Assert.AreEqual(user, actualUser);
            DtoAssert.AreEqual(updatedProposedUserDataDto, actualUser.GetUserDataDto());
            DtoAssert.AreEqual(updatedProposedUserContactDto, actualUser.GetUserContactDto());
        }
示例#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();
        }