Пример #1
0
        public void UpsertGroup()
        {
            g0.Description = "g0_description";
            _dal.UpsertGroup(g0);

            List <Group> found = _dal.GetGroupByName(g0.Name);

            Assert.AreEqual(1, found.Count);
            bool eq = g0.Description.Equals(found[0].Description);

            Assert.IsTrue(eq);
        }
Пример #2
0
        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);
        }