Ejemplo n.º 1
0
        private void ViewUserGroupMenuItem_Click(object sender, EventArgs e)
        {
            List <String> groups = UserGroups.GetAllGroups();

            string groupName = InputBoxMx.Show(
                "Select the User Group that you want to view", "View User Group", "", groups, -1, -1);

            if (Lex.IsNullOrEmpty(groupName))
            {
                return;
            }

            DialogResult dr = PermissionsGroupEditor.Show(groupName, false);

            return;
        }
Ejemplo n.º 2
0
        public void CreateNewGroup_NewGroup_GroupAdded()
        {
            var userId = 6;
            var groupName = "neweditor";
            var groupId = 10;


            var cache = GetGroupsCache(_mocks);

            var reader = _mocks.DynamicMock<IDnaDataReader>();
            reader.Stub(x => x.Read()).Return(true);
            reader.Stub(x => x.GetInt32("newid")).Return(groupId);
            var creator = _mocks.DynamicMock<IDnaDataReaderCreator>();
            creator.Stub(x => x.CreateDnaDataReader("createnewusergroup")).Return(reader);
            var diag = _mocks.DynamicMock<IDnaDiagnostics>();
            _mocks.ReplayAll();

            var obj = new UserGroups(creator, diag, cache, null, null);

            Assert.IsTrue(obj.CreateNewGroup(groupName, userId));
            Assert.IsTrue(obj.GetAllGroups().Exists(x => x.Name == groupName));

            creator.AssertWasCalled(x => x.CreateDnaDataReader("createnewusergroup"));
        }
Ejemplo n.º 3
0
        public void CreateNewGroup_NewGroup_CorrectlyAddsGroup()
        {
            var userId = 10;
            var groupName = "newgroup";

            var cache = GetGroupsCache(_mocks);

            var reader = _mocks.DynamicMock<IDnaDataReader>();
            var creator = _mocks.DynamicMock<IDnaDataReaderCreator>();
            creator.Stub(x => x.CreateDnaDataReader("createnewusergroup")).Return(reader);
            var diag = _mocks.DynamicMock<IDnaDiagnostics>();
            _mocks.ReplayAll();

            var obj = new UserGroups(creator, diag, cache, null, null);

            Assert.IsTrue(obj.CreateNewGroup(groupName, userId));
            Assert.IsTrue(obj.GetAllGroups().Exists(x => x.Name == groupName));

        }