Exemple #1
0
        public void TestUpdate()
        {
            // given:
            UserGroup userGroupToUpdate = UserGroupCreator.Create();

            string           expectedAdditionalInformations = "Keine";
            string           expectedName            = "die firma";
            int              expectedAcceptedBalance = -20;
            UserGroupDto     userGroupDtoForUpdate   = new UserGroupDto(expectedAdditionalInformations, expectedName, expectedAcceptedBalance);
            User             changedBy        = UserCreator.Create("changed by");
            DateTime         changedAt        = new DateTime(2016, 12, 22);
            EntityChangedDto entityChangedDto = new EntityChangedDto(changedBy, changedAt);

            // when:
            userGroupToUpdate.Update(userGroupDtoForUpdate, entityChangedDto);
            UserGroupDao.FlushAndClear();
            UserGroup actualBrokerPool = UserGroupDao.Get(userGroupToUpdate.Id);

            // then:
            actualBrokerPool.GetDto().ShouldBeEquivalentTo(userGroupDtoForUpdate);
            actualBrokerPool.AdditionalInformations.ShouldBeEquivalentTo(expectedAdditionalInformations);
            actualBrokerPool.BalanceOverdraftLimit.ShouldBeEquivalentTo(expectedAcceptedBalance);
            actualBrokerPool.ChangedAt.Should().Be(changedAt);
            actualBrokerPool.ChangedBy.Should().Be(changedBy);
            actualBrokerPool.Name.ShouldBeEquivalentTo(expectedName);
        }
Exemple #2
0
        public void TestSaveAndLoad()
        {
            // given:
            string expectedAdditionalInformations = "Keine";
            string expectedName    = "die firma";
            int    acceptedBalance = -10;

            UserGroupDto userGroupDto = new UserGroupDto(expectedAdditionalInformations, expectedName, acceptedBalance);

            DateTime         createdAt        = new DateTime(2016, 12, 12);
            User             createdBy        = UserCreator.Create();
            EntityCreatedDto entityCreatedDto = new EntityCreatedDto(createdBy, createdAt);
            UserGroup        userGroup        = new UserGroup(userGroupDto, entityCreatedDto);

            // when:
            userGroup = UserGroupDao.Save(userGroup);
            UserGroupDao.FlushAndClear();
            UserGroup actualBrokerPool = UserGroupDao.Get(userGroup.Id);

            // then:
            actualBrokerPool.GetDto().ShouldBeEquivalentTo(userGroupDto);
            actualBrokerPool.AdditionalInformations.ShouldBeEquivalentTo(expectedAdditionalInformations);
            actualBrokerPool.ChangedAt.Should().Be(null);
            actualBrokerPool.ChangedBy.Should().BeNull();
            actualBrokerPool.CreatedAt.ShouldBeEquivalentTo(createdAt);
            actualBrokerPool.CreatedBy.ShouldBeEquivalentTo(createdBy);
            actualBrokerPool.Name.ShouldBeEquivalentTo(expectedName);
            actualBrokerPool.BalanceOverdraftLimit.ShouldBeEquivalentTo(acceptedBalance);
        }