public void UpsertGroupMembership() { Group lg0 = new Group { Name = "lg0", IsLocal = true }; Group lg1 = new Group { Name = "lg1", IsLocal = true }; Group lg2 = new Group { Name = "lg2", IsLocal = true }; Group lg3 = new Group { Name = "lg3", IsLocal = true, IsEnabled = false }; Group lg4 = new Group { Name = "lg4", IsLocal = true }; Group lg5 = new Group { Name = "lg5", IsLocal = true }; _dal.UpsertGroup(lg0); _dal.UpsertGroup(lg1); _dal.UpsertGroup(lg2); _dal.UpsertGroup(lg3); _dal.UpsertGroup(lg4); _dal.UpsertGroup(lg5); GroupMembershipItem lg0g1 = new GroupMembershipItem { GroupUId = lg0.UId, MemberUId = lg1.UId }; GroupMembershipItem lg0g2 = new GroupMembershipItem { GroupUId = lg0.UId, MemberUId = lg2.UId }; GroupMembershipItem lg2g3 = new GroupMembershipItem { GroupUId = lg0.UId, MemberUId = lg3.UId }; GroupMembershipItem lg2g4 = new GroupMembershipItem { GroupUId = lg0.UId, MemberUId = lg4.UId }; _dal.UpsertGroupMembership(lg0g1); _dal.UpsertGroupMembership(lg0g2); _dal.UpsertGroupMembership(lg2g3); _dal.UpsertGroupMembership(lg2g4); List <GroupMembershipItem> m = _dal.GetGroupMembers(lg0).ToList(); Assert.AreEqual(3, m.Count); lg0.IsLocal = false; _dal.UpsertGroup(lg0); m = _dal.GetGroupMembers(lg0).ToList(); Assert.AreEqual(0, m.Count); }
public void Init() { _store = new SuplexStore(); _dal = new MemoryDal(_store); u0 = new User { Name = "u0" }; u1 = new User { Name = "u1" }; u2 = new User { Name = "u2" }; u3 = new User { Name = "u3", IsEnabled = false }; u4 = new User { Name = "u4" }; u5 = new User { Name = "u5" }; _dal.UpsertUser(u0); _dal.UpsertUser(u1); _dal.UpsertUser(u2); _dal.UpsertUser(u3); _dal.UpsertUser(u4); _dal.UpsertUser(u5); g0 = new Group { Name = "g0", IsLocal = true }; g1 = new Group { Name = "g1", IsEnabled = false }; g2 = new Group { Name = "g2" }; g3 = new Group { Name = "g3", IsLocal = true, IsEnabled = false }; g4 = new Group { Name = "g4", IsLocal = true }; g5 = new Group { Name = "g5", IsLocal = true }; _dal.UpsertGroup(g0); _dal.UpsertGroup(g1); _dal.UpsertGroup(g2); _dal.UpsertGroup(g3); _dal.UpsertGroup(g4); _dal.UpsertGroup(g5); g0g1 = new GroupMembershipItem { GroupUId = g0.UId, MemberUId = g1.UId }; g0g2 = new GroupMembershipItem { GroupUId = g0.UId, MemberUId = g2.UId }; g2g3 = new GroupMembershipItem { GroupUId = g2.UId, MemberUId = g3.UId }; g2g4 = new GroupMembershipItem { GroupUId = g2.UId, MemberUId = g4.UId }; g2g4 = new GroupMembershipItem { GroupUId = g3.UId, MemberUId = g4.UId }; _dal.UpsertGroupMembership(g0g1); _dal.UpsertGroupMembership(g0g2); _dal.UpsertGroupMembership(g2g3); _dal.UpsertGroupMembership(g2g4); g0u0 = new GroupMembershipItem(g0, u0); g1u1 = new GroupMembershipItem(g1, u1); g2u2 = new GroupMembershipItem(g2, u2); g3u3 = new GroupMembershipItem(g3, u3); g4u4 = new GroupMembershipItem(g4, u4); g5u5 = new GroupMembershipItem(g5, u5); _dal.UpsertGroupMembership(g0u0); _dal.UpsertGroupMembership(g1u1); _dal.UpsertGroupMembership(g2u2); _dal.UpsertGroupMembership(g3u3); _dal.UpsertGroupMembership(g4u4); _dal.UpsertGroupMembership(g5u5); }