示例#1
0
        public async Task GetGroupsByDomainIdReturnsGroupsWhenDomainInGroups()
        {
            int domainId = TestHelpers.CreateDomain(ConnectionString, Domain1);

            int group1Id = TestHelpers.CreateGroup(ConnectionString, Group1);
            int group2Id = TestHelpers.CreateGroup(ConnectionString, Group2);
            int group3Id = TestHelpers.CreateGroup(ConnectionString, Group3);
            int group4Id = TestHelpers.CreateGroup(ConnectionString, Group4);

            TestHelpers.CreateGroupDomainMapping(ConnectionString, new List <Tuple <int, int> >
            {
                Tuple.Create(group1Id, domainId),
                Tuple.Create(group2Id, domainId),
                Tuple.Create(group3Id, domainId),
                Tuple.Create(group4Id, domainId),
            });

            List <Api.Domain.Group> groups = await _groupDao.GetGroupsByDomainId(domainId, string.Empty, 1, 10);

            Assert.That(groups.Count, Is.EqualTo(4));
            Assert.That(groups[0].Id, Is.EqualTo(group1Id));
            Assert.That(groups[0].Name, Is.EqualTo(Group1));
            Assert.That(groups[1].Id, Is.EqualTo(group2Id));
            Assert.That(groups[1].Name, Is.EqualTo(Group2));
            Assert.That(groups[2].Id, Is.EqualTo(group3Id));
            Assert.That(groups[2].Name, Is.EqualTo(Group3));
            Assert.That(groups[3].Id, Is.EqualTo(group4Id));
            Assert.That(groups[3].Name, Is.EqualTo(Group4));
        }