Ejemplo n.º 1
0
        public void Test1UserListClassTest_CreateNewUsersList()
        {
            UserList userList = new UserList(_InputContext);
            Assert.IsTrue(userList.CreateNewUsersList(10, "YEAR", 10, 0, false, "", _InputContext.CurrentSite.SiteID, 0), "Failed creation of list");

            XmlElement xml = userList.RootElement;
            
            Assert.IsTrue(xml.SelectSingleNode("USER-LIST") != null, "The xml is not generated correctly!!!");
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
        }
Ejemplo n.º 2
0
        public void Test2UserListClassTest_CreateSubEditorsList()
        {
            UserList userList = new UserList(_InputContext);
            Assert.IsTrue(userList.CreateSubEditorsList(10, 0), "CreateSubEditorsList failed and returned false");

            Assert.IsTrue(userList.RootElement.SelectSingleNode("USER-LIST") != null, "The xml is not generated correctly!!!");
            DnaXmlValidator validator = new DnaXmlValidator(userList.RootElement.InnerXml, _schemaUri);
            validator.Validate();
        }
Ejemplo n.º 3
0
        public void Test7UserListClassTest_RemoveUser()
        {
            UserList userList = new UserList(_InputContext);
            Assert.IsTrue(userList.CreateNewUsersList(10, "YEAR", 10, 0, false, "", _InputContext.CurrentSite.SiteID, 0), "Failed creation of list");

            int[] userIds = null;
            Assert.IsTrue(userList.GetUserIDs(ref userIds), "GetUserIDs failed to return");
            Assert.IsFalse(userIds == null || userIds.Length == 0, "Incorrect number of users returned");
            Assert.IsTrue(userList.RemoveUser(userIds[0]), "RemoveUser failed to return");
            Assert.IsFalse(userList.FindUserInList(userIds[0]), "Found removed user in list");
        }
Ejemplo n.º 4
0
        public void Test8UserListClassTest_AddCurrentUserToList()
        {
            using (FullInputContext fullinputcontext = new FullInputContext(TestUserAccounts.GetNormalUserAccount.IdentityUserName))
            {
                fullinputcontext.SetCurrentSite("h2g2");

                fullinputcontext.InitUserFromCookie(TestUserAccounts.GetNormalUserAccount.Cookie, TestUserAccounts.GetNormalUserAccount.SecureCookie);

                UserList userList = new UserList(fullinputcontext);
                Assert.IsTrue(userList.CreateNewUsersList(10, "YEAR", 100, 0, false, "", _InputContext.CurrentSite.SiteID, 0), "Failed creation of list");

                Assert.IsTrue(userList.AddCurrentUserToList(), "RemoveUser failed to return");
                Assert.IsTrue(userList.FindUserInList(fullinputcontext.ViewingUser.UserID), "Failed to find added user in list");
            }
        }
Ejemplo n.º 5
0
        public void Test4UserListClassTest_CreateGroupMembershipList()
        {
            UserList userList = new UserList(_InputContext);
            Assert.IsTrue(userList.CreateGroupMembershipList("Subs"), "CreateGroupMembershipList(subs) failed and returned false");

            XmlElement xml = userList.RootElement;
            Assert.IsTrue(xml.SelectSingleNode("USER-LIST") != null, "The xml is not generated correctly!!!");
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
        }