當前位置: 首頁>>代碼示例>>C#>>正文


C# FullInputContext.SetCurrentSite方法代碼示例

本文整理匯總了C#中Tests.FullInputContext.SetCurrentSite方法的典型用法代碼示例。如果您正苦於以下問題:C# FullInputContext.SetCurrentSite方法的具體用法?C# FullInputContext.SetCurrentSite怎麽用?C# FullInputContext.SetCurrentSite使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tests.FullInputContext的用法示例。


在下文中一共展示了FullInputContext.SetCurrentSite方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestAbsentSkinParams

		public void TestAbsentSkinParams()
		{
            Console.WriteLine("TestAbsentSkinParams");
            using (FullInputContext inputcontext = new FullInputContext(""))
            {
                inputcontext.SetCurrentSite("h2g2");
                inputcontext.InitDefaultUser();

                inputcontext.AddParam("notaskinparam", "abcde");
                inputcontext.AddParam("ss_not", "doesn't matter");

                SkinParams sparams = new SkinParams(inputcontext);
                sparams.ProcessRequest();
                DnaXmlValidator validator = new DnaXmlValidator(sparams.RootElement.InnerXml, _schemaUri);
                validator.Validate();

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(sparams.RootElement.OuterXml);

                XmlNode node = doc.SelectSingleNode("/DNAROOT/PARAMS");
                Assert.IsNotNull(node, "No PARAMS element found");
                XmlNodeList nodes = doc.SelectNodes("/DNAROOT/PARAMS/PARAM");

                Assert.IsNotNull(nodes, "Unable to find /DNAROOT/PARAMS/PARAM");

                Assert.IsTrue(nodes.Count == 0, string.Format("Expecting 0 s_ params in query, found {0}", nodes.Count));
            }
		}
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:28,代碼來源:SkinParamsTests.cs

示例2: UserTests

  /// <summary>
  /// Constructor for the User Tests to set up the context for the tests
  /// </summary>
  public UserTests()
  {
      using (FullInputContext fullinputcontext = new FullInputContext(TestUserAccounts.GetProfileAPITestUserAccount.UserName))
      {
          fullinputcontext.SetCurrentSite("h2g2");
          fullinputcontext.InitUserFromCookie(TestUserAccounts.GetProfileAPITestUserAccount.Cookie, TestUserAccounts.GetProfileAPITestUserAccount.SecureCookie);
          _testUser = (User)fullinputcontext.ViewingUser;
      }
 }
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:12,代碼來源:UserTests.cs

示例3: InitialiseSiteList

 private static void InitialiseSiteList()
 {
     if (!_siteListloaded)
     {
         using (FullInputContext inputcontext = new FullInputContext(""))
         {
             _testSiteList = SiteList.GetSiteList();
             inputcontext.SetCurrentSite("h2g2");
             inputcontext.InitDefaultUser();
             _siteListloaded = true;
         }
     }
 }
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:13,代碼來源:SiteListTests.cs

示例4: TestSkinParams

		public void TestSkinParams()
		{
            Console.WriteLine("TestSkinParams");
            using (FullInputContext inputcontext = new FullInputContext(""))
            {
                inputcontext.SetCurrentSite("h2g2");
                inputcontext.InitDefaultUser();

                inputcontext.AddParam("s_abcde", "xyzzy");
                inputcontext.AddParam("notaskinparam", "abcde");
                inputcontext.AddParam("s_xxxxx", "plugh");
                inputcontext.AddParam("ss_not", "doesn't matter");

                SkinParams sparams = new SkinParams(inputcontext);
                sparams.ProcessRequest();
                DnaXmlValidator validator = new DnaXmlValidator(sparams.RootElement.InnerXml, _schemaUri);
                validator.Validate();

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(sparams.RootElement.OuterXml);

                XmlNode node = doc.SelectSingleNode("/DNAROOT/PARAMS");
                Assert.IsNotNull(node, "No PARAMS element found");
                XmlNodeList nodes = doc.SelectNodes("/DNAROOT/PARAMS/PARAM");

                Assert.IsNotNull(nodes, "Unable to find /DNAROOT/PARAMS/PARAM");

                Assert.IsTrue(nodes.Count == 2, string.Format("Expecting 2 s_ params in query, found {0}", nodes.Count));

                foreach (XmlNode subnode in nodes)
                {
                    XmlNode name = subnode.SelectSingleNode("NAME");
                    XmlNode value = subnode.SelectSingleNode("VALUE");
                    Assert.IsNotNull(name, "NAME missing from PARAM object");
                    Assert.IsNotNull(value, "VALUE missing from PARAM object");
                    if (name.InnerText == "s_abcde")
                    {
                        Assert.AreEqual(value.InnerText, "xyzzy", "s_abcde value doesn't match");
                    }
                    else if (name.InnerText == "s_xxxxx")
                    {
                        Assert.AreEqual(value.InnerText, "plugh", "Value of s_xxxxx doesn't match");
                    }
                    else
                    {
                        Assert.Fail(string.Format("Unexpected param found: {0}", name.InnerText));
                    }
                }
            }
		}
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:50,代碼來源:SkinParamsTests.cs

示例5: Test6CheckUserNameChange

        public void Test6CheckUserNameChange()
        {
            Console.WriteLine("Before Test6CheckUserNameChange");
            string originalUserName = _testUser.UserName;

            //change to new user name
            string newUserName = originalUserName + "new";
            _testUser.BeginUpdateDetails();
            _testUser.SetUsername(newUserName);
            _testUser.UpdateDetails();

            using (FullInputContext fullinputcontext = new FullInputContext(TestUserAccounts.GetProfileAPITestUserAccount.UserName))
            {
                fullinputcontext.SetCurrentSite("h2g2");
                fullinputcontext.InitUserFromCookie(TestUserAccounts.GetProfileAPITestUserAccount.Cookie, TestUserAccounts.GetProfileAPITestUserAccount.SecureCookie);
                User tempUser = new User(fullinputcontext);
                tempUser.CreateUser(_testUser.UserID);
                Assert.AreEqual(tempUser.UserName, newUserName);
            }

            //change back to old user name
            _testUser.BeginUpdateDetails();
            _testUser.SetUsername(originalUserName);
            _testUser.UpdateDetails();

            using (FullInputContext fullinputcontext = new FullInputContext(TestUserAccounts.GetProfileAPITestUserAccount.UserName))
            {
                fullinputcontext.SetCurrentSite("h2g2");
                fullinputcontext.InitUserFromCookie(TestUserAccounts.GetProfileAPITestUserAccount.Cookie, TestUserAccounts.GetProfileAPITestUserAccount.SecureCookie);
                User tempUser = new User(fullinputcontext);
                tempUser.CreateUser(_testUser.UserID);
                Assert.AreEqual(tempUser.UserName, originalUserName);
            }
            

            Console.WriteLine("After Test6CheckUserNameChange");
        }
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:37,代碼來源:UserTests.cs

示例6: Test8UserListClassTest_AddCurrentUserToList

        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");
            }
        }
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:15,代碼來源:UserListTests.cs


注:本文中的Tests.FullInputContext.SetCurrentSite方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。