public async Task GetGroupsByUserIdReturnsGroupsWhenUserInGroups() { int userId = TestHelpers.CreateUser(ConnectionString, FirstName, LastName, Email); 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.CreateGroupUserMapping(ConnectionString, new List <Tuple <int, int> > { Tuple.Create(group1Id, userId), Tuple.Create(group2Id, userId), Tuple.Create(group3Id, userId), Tuple.Create(group4Id, userId), }); List <Api.Domain.Group> groups = await _groupDao.GetGroupsByUserId(userId, 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)); }