Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public void TestAreUsersAssigned()
        {
            // given:
            UserGroup userGroup = UserGroupCreator.Create();
            User      user      = UserCreator.Create("ein nutzer");

            UserGroupDao.Save(new UserGroupMembership(userGroup, user, UserGroupMembershipType.Member, new EntityCreatedDto(user, DateTime.Now)));

            // when:
            bool actualAreUsersAssigned = UserGroupDao.AreUsersAssigned(userGroup);

            // then:
            actualAreUsersAssigned.Should().BeTrue();
        }