ClientScriptManagerTest.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. //
  2. // Tests for System.Web.UI.ClientScriptManagerTest.cs
  3. //
  4. // Author:
  5. // Yoni Klein ([email protected])
  6. //
  7. //
  8. // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. #if NET_2_0
  29. using System;
  30. using System.Web;
  31. using System.Web.UI;
  32. using System.Web.UI.WebControls;
  33. using NUnit.Framework;
  34. using MonoTests.stand_alone.WebHarness;
  35. using MonoTests.SystemWeb.Framework;
  36. using System.Text;
  37. using System.Threading;
  38. namespace MonoTests.System.Web.UI.WebControls
  39. {
  40. public class MyPage : Page, ICallbackEventHandler
  41. {
  42. #region ICallbackEventHandler Members
  43. public string GetCallbackResult ()
  44. {
  45. throw new Exception ("The method or operation is not implemented.");
  46. }
  47. public void RaiseCallbackEvent (string eventArgument)
  48. {
  49. throw new Exception ("The method or operation is not implemented.");
  50. }
  51. #endregion
  52. }
  53. [TestFixture]
  54. public class ClientScriptManagerTest
  55. {
  56. [TestFixtureSetUp]
  57. public void Set_Up ()
  58. {
  59. #if DOT_NET
  60. WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.EventValidationTest1.aspx", "EventValidationTest1.aspx");
  61. WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.EventValidationTest2.aspx", "EventValidationTest2.aspx");
  62. #else
  63. WebTest.CopyResource (GetType (), "EventValidationTest1.aspx", "EventValidationTest1.aspx");
  64. WebTest.CopyResource (GetType (), "EventValidationTest2.aspx", "EventValidationTest2.aspx");
  65. #endif
  66. }
  67. [SetUp]
  68. public void SetupTestCase ()
  69. {
  70. Thread.Sleep (100);
  71. }
  72. [Test]
  73. [Category("NotWorking")]
  74. public void ClientScriptManager_GetCallbackEventReference_1 ()
  75. {
  76. MyPage p = new MyPage ();
  77. ClientScriptManager cs = p.ClientScript;
  78. StringBuilder context1 = new StringBuilder ();
  79. context1.Append ("function ReceiveServerData1(arg, context)");
  80. context1.Append ("{");
  81. context1.Append ("Message1.innerText = arg;");
  82. context1.Append ("value1 = arg;");
  83. context1.Append ("}");
  84. // Define callback references.
  85. String cbReference = cs.GetCallbackEventReference (p, "arg",
  86. "ReceiveServerData1", context1.ToString ());
  87. Assert.AreEqual ("WebForm_DoCallback('__Page',arg,ReceiveServerData1,function ReceiveServerData1(arg, context){Message1.innerText = arg;value1 = arg;},null,false)", cbReference, "GetCallbackEventReferenceFail1");
  88. }
  89. [Test]
  90. [Category ("NotWorking")]
  91. public void ClientScriptManager_GetCallbackEventReference_2 ()
  92. {
  93. MyPage p = new MyPage ();
  94. ClientScriptManager cs = p.ClientScript;
  95. StringBuilder context1 = new StringBuilder ();
  96. context1.Append ("function ReceiveServerData1(arg, context)");
  97. context1.Append ("{");
  98. context1.Append ("Message1.innerText = arg;");
  99. context1.Append ("value1 = arg;");
  100. context1.Append ("}");
  101. // Define callback references.
  102. String cbReference = cs.GetCallbackEventReference (p, "arg",
  103. "ReceiveServerData1", context1.ToString (), true);
  104. Assert.AreEqual ("WebForm_DoCallback('__Page',arg,ReceiveServerData1,function ReceiveServerData1(arg, context){Message1.innerText = arg;value1 = arg;},null,true)", cbReference, "GetCallbackEventReferenceFail2");
  105. }
  106. [Test]
  107. [Category ("NotWorking")]
  108. public void ClientScriptManager_GetCallbackEventReference_3 ()
  109. {
  110. MyPage p = new MyPage ();
  111. ClientScriptManager cs = p.ClientScript;
  112. StringBuilder context1 = new StringBuilder ();
  113. context1.Append ("function ReceiveServerData1(arg, context)");
  114. context1.Append ("{");
  115. context1.Append ("Message1.innerText = arg;");
  116. context1.Append ("value1 = arg;");
  117. context1.Append ("}");
  118. // Define callback references.
  119. String cbReference = cs.GetCallbackEventReference (p, "arg",
  120. "ReceiveServerData1", context1.ToString (), "ErrorCallback", false);
  121. Assert.AreEqual ("WebForm_DoCallback('__Page',arg,ReceiveServerData1,function ReceiveServerData1(arg, context){Message1.innerText = arg;value1 = arg;},ErrorCallback,false)", cbReference, "GetCallbackEventReferenceFail3");
  122. }
  123. [Test]
  124. [Category ("NotWorking")]
  125. public void ClientScriptManager_GetPostBackEventReference_1 ()
  126. {
  127. MyPage p = new MyPage ();
  128. ClientScriptManager cs = p.ClientScript;
  129. String result = cs.GetPostBackEventReference (new PostBackOptions (p, "args"));
  130. Assert.AreEqual ("__doPostBack('__Page','args')", result, "GetPostBackEventReference#1");
  131. }
  132. [Test]
  133. public void ClientScriptManager_GetPostBackEventReference_2 ()
  134. {
  135. MyPage p = new MyPage ();
  136. ClientScriptManager cs = p.ClientScript;
  137. String result = cs.GetPostBackEventReference (p, "args");
  138. Assert.AreEqual ("__doPostBack('__Page','args')", result, "GetPostBackEventReference#2");
  139. }
  140. [Test]
  141. public void ClientScriptManager_GetPostBackClientHyperlink ()
  142. {
  143. MyPage p = new MyPage ();
  144. ClientScriptManager cs = p.ClientScript;
  145. String hyperlink = cs.GetPostBackClientHyperlink (p, "args");
  146. Assert.AreEqual ("javascript:__doPostBack('__Page','args')", hyperlink, "GetPostBackClientHyperlink");
  147. }
  148. [Test]
  149. [Category("NunitWeb")]
  150. [Category ("NotWorking")]
  151. public void ClientScriptManager_GetWebResourceUrl ()
  152. {
  153. string html = new WebTest (PageInvoker.CreateOnLoad (GetWebResourceUrlLoad)).Run();
  154. }
  155. public static void GetWebResourceUrlLoad (Page p)
  156. {
  157. ClientScriptManager cs = p.ClientScript;
  158. String cbReference = cs.GetWebResourceUrl (typeof (MonoTests.System.Web.UI.WebControls.ClientScriptManagerTest), "ClientScript.js");
  159. if (cbReference.IndexOf("/NunitWeb/WebResource.axd?")<0)
  160. Assert.Fail ("GetWebResourceUrlFail");
  161. }
  162. [Test]
  163. [Category ("NotWorking")]
  164. public void ClientScriptManager_IsClientScriptBlockRegistered ()
  165. {
  166. Page p = new Page ();
  167. ClientScriptManager cs = p.ClientScript;
  168. String csname2 = "ButtonClickScript";
  169. Type cstype = p.GetType ();
  170. StringBuilder cstext2 = new StringBuilder ();
  171. cstext2.Append ("<script type=text/javascript> function DoClick() {");
  172. cstext2.Append ("alert('Text from client script.')} </");
  173. cstext2.Append ("script>");
  174. cs.RegisterClientScriptBlock (cstype, csname2, cstext2.ToString ());
  175. Assert.AreEqual (true, cs.IsClientScriptBlockRegistered (csname2), "ClientScriptBlockRegisterFail#1");
  176. }
  177. [Test]
  178. [Category ("NotWorking")]
  179. public void ClientScriptManager_IsRegisterClientScriptInclude ()
  180. {
  181. Page p = new Page ();
  182. String csname = "ButtonClickScript";
  183. String csurl = "ClientScript.js";
  184. Type cstype = p.GetType ();
  185. ClientScriptManager cs = p.ClientScript;
  186. cs.RegisterClientScriptInclude (cstype, csname, csurl);
  187. bool registry = cs.IsClientScriptIncludeRegistered (csname);
  188. Assert.AreEqual (true, registry, "RegisterClientScriptIncludeFail");
  189. }
  190. [Test]
  191. [Category ("NotWorking")]
  192. public void ClientScriptManager_IsRegisterOnSubmitStatement ()
  193. {
  194. Page p = new Page ();
  195. String csname = "ButtonClickScript";
  196. Type cstype = p.GetType ();
  197. ClientScriptManager cs = p.ClientScript;
  198. cs.RegisterClientScriptInclude (cstype, csname, "document.write('Text from OnSubmit statement');");
  199. bool registry = cs.IsClientScriptIncludeRegistered (csname);
  200. Assert.AreEqual (true, registry, "RegisterClientScriptIncludeFail");
  201. }
  202. [Test]
  203. [Category ("NunitWeb")]
  204. [Category ("NotWorking")]
  205. public void ClientScriptManager_RegisterOnSubmitStatement ()
  206. {
  207. WebTest t = new WebTest (PageInvoker.CreateOnLoad (RegisterOnSubmitStatement));
  208. string html = t.Run ();
  209. if (html.IndexOf ("WebForm_OnSubmit()") < 0)
  210. Assert.Fail ("RegisterOnSubmitStatement");
  211. }
  212. public static void RegisterOnSubmitStatement (Page p)
  213. {
  214. String csname = "OnSubmitScript";
  215. Type cstype = p.GetType ();
  216. ClientScriptManager cs = p.ClientScript;
  217. String cstext = "document.write('Text from OnSubmit statement');";
  218. cs.RegisterOnSubmitStatement (cstype, csname, cstext);
  219. }
  220. [Test]
  221. [Category ("NunitWeb")]
  222. public void ClientScriptManager_RegisterClientScriptInclude ()
  223. {
  224. WebTest t = new WebTest (PageInvoker.CreateOnLoad (RegisterClientScriptInclude));
  225. string html = t.Run ();
  226. if (html.IndexOf ("script_include.js") < 0)
  227. Assert.Fail ("RegisterClientScriptIncludeFail");
  228. }
  229. public static void RegisterClientScriptInclude (Page p)
  230. {
  231. String csname = "ButtonClickScript";
  232. String csurl = "script_include.js";
  233. Type cstype = p.GetType ();
  234. ClientScriptManager cs = p.ClientScript;
  235. cs.RegisterClientScriptInclude (cstype, csname, csurl);
  236. }
  237. [Test]
  238. [Category("NunitWeb")]
  239. public void ClientScriptManager_ClientScriptBlockRegister()
  240. {
  241. WebTest t = new WebTest (PageInvoker.CreateOnLoad (ClientScriptBlockRegister));
  242. string html = t.Run ();
  243. if( html.IndexOf("DoClick()") < 0)
  244. Assert.Fail ("ClientScriptBlockRegisterFail#2");
  245. }
  246. public static void ClientScriptBlockRegister (Page p)
  247. {
  248. ClientScriptManager cs = p.ClientScript;
  249. String csname2 = "ButtonClickScript";
  250. Type cstype = p.GetType ();
  251. StringBuilder cstext2 = new StringBuilder ();
  252. cstext2.Append ("<script type=text/javascript> function DoClick() {");
  253. cstext2.Append ("alert('Text from client script.')} </");
  254. cstext2.Append ("script>");
  255. cs.RegisterClientScriptBlock (cstype, csname2, cstext2.ToString ());
  256. }
  257. [Test]
  258. [Category ("NunitWeb")]
  259. [Category ("NotWorking")]
  260. public void ClientScriptManager_IsRegisterStartupScript ()
  261. {
  262. Page p = new Page ();
  263. String csname1 = "PopupScript";
  264. Type cstype = p.GetType ();
  265. ClientScriptManager cs = p.ClientScript;
  266. String cstext1 = "alert('Hello World');";
  267. cs.RegisterStartupScript (cstype, csname1, cstext1);
  268. Assert.AreEqual (true,cs.IsStartupScriptRegistered(csname1) , "StartupScriptRegisteredFail");
  269. }
  270. [Test]
  271. [Category ("NunitWeb")]
  272. public void ClientScriptManager_RegisterStartupScript ()
  273. {
  274. WebTest t = new WebTest (PageInvoker.CreateOnLoad (RegisterStartupScript));
  275. string html = t.Run ();
  276. if (html.IndexOf ("alert('Hello World');") < 0)
  277. Assert.Fail ("RegisterStartupScriptFail#1");
  278. }
  279. public static void RegisterStartupScript (Page p)
  280. {
  281. String csname1 = "PopupScript";
  282. Type cstype = p.GetType ();
  283. ClientScriptManager cs = p.ClientScript;
  284. String cstext1 = "alert('Hello World');";
  285. cs.RegisterStartupScript (cstype, csname1, cstext1,true);
  286. }
  287. [Test]
  288. [Category ("NunitWeb")]
  289. public void ClientScriptManager_RegisterArrayDeclaration ()
  290. {
  291. WebTest t = new WebTest (PageInvoker.CreateOnLoad (RegisterArrayDeclaration));
  292. string html = t.Run ();
  293. if (html.IndexOf ("var MyArray = new Array(\"1\", \"2\", \"text\");") < 0)
  294. Assert.Fail ("RegisterArrayDeclarationFail#1");
  295. }
  296. public static void RegisterArrayDeclaration (Page p)
  297. {
  298. Type cstype = p.GetType ();
  299. ClientScriptManager cs = p.ClientScript;
  300. String arrName = "MyArray";
  301. String arrValue = "\"1\", \"2\", \"text\"";
  302. // Register the array with the Page class.
  303. cs.RegisterArrayDeclaration (arrName, arrValue);
  304. }
  305. [Test]
  306. [Category ("NunitWeb")]
  307. [Category ("NotWorking")]
  308. public void ClientScriptManager_RegisterExpandAttribute ()
  309. {
  310. WebTest t = new WebTest (PageInvoker.CreateOnLoad (RegisterExpandAttribute));
  311. string html = t.Run ();
  312. if (html.IndexOf ("Message.title = \"New title from client script.\"") < 0)
  313. Assert.Fail ("RegisterExpandAttributeFail");
  314. }
  315. public static void RegisterExpandAttribute (Page p)
  316. {
  317. ClientScriptManager cs = p.ClientScript;
  318. cs.RegisterExpandoAttribute ("Message", "title", "New title from client script.", true);
  319. }
  320. [Test]
  321. [Category ("NunitWeb")]
  322. [Category ("NotWorking")]
  323. public void ClientScriptManager_RegisterHiddenField ()
  324. {
  325. WebTest t = new WebTest (PageInvoker.CreateOnLoad (RegisterHiddenField));
  326. string html = t.Run ();
  327. if (html.IndexOf ("<input type=\"hidden\" name=\"MyHiddenField\" id=\"MyHiddenField\" value=\"3\" />") < 0)
  328. Assert.Fail ("RegisterHiddenFieldFail");
  329. }
  330. public static void RegisterHiddenField (Page p)
  331. {
  332. ClientScriptManager cs = p.ClientScript;
  333. // Define the hidden field name and initial value.
  334. String hiddenName = "MyHiddenField";
  335. String hiddenValue = "3";
  336. // Register the hidden field with the Page class.
  337. cs.RegisterHiddenField (hiddenName, hiddenValue);
  338. }
  339. [Test]
  340. [Category ("NunitWeb")]
  341. [Category ("NotWorking")]
  342. public void ClientScriptManager_RegisterForEventValidation_1 ()
  343. {
  344. WebTest t = new WebTest ("EventValidationTest1.aspx");
  345. string html = t.Run ();
  346. FormRequest fr = new FormRequest (t.Response, "form1");
  347. fr.Controls.Add ("__EVENTTARGET");
  348. fr.Controls.Add ("__EVENTARGUMENT");
  349. fr.Controls.Add ("__CALLBACKID");
  350. fr.Controls.Add ("__CALLBACKPARAM");
  351. fr.Controls["__EVENTTARGET"].Value = "";
  352. fr.Controls["__EVENTARGUMENT"].Value = "";
  353. fr.Controls["__CALLBACKID"].Value = "__Page";
  354. t.Request = fr;
  355. html = t.Run ();
  356. if(html.IndexOf("Correct event raised callback.")<0)
  357. Assert.Fail ("RegisterForEventValidationFail#1");
  358. }
  359. [Test]
  360. [Category ("NunitWeb")]
  361. [Category ("NotWorking")]
  362. public void ClientScriptManager_RegisterForEventValidation_2 ()
  363. {
  364. WebTest t = new WebTest ("EventValidationTest2.aspx");
  365. string html = t.Run ();
  366. FormRequest fr = new FormRequest (t.Response, "form1");
  367. fr.Controls.Add ("__EVENTTARGET");
  368. fr.Controls.Add ("__EVENTARGUMENT");
  369. fr.Controls.Add ("__CALLBACKID");
  370. fr.Controls.Add ("__CALLBACKPARAM");
  371. fr.Controls["__EVENTTARGET"].Value = "";
  372. fr.Controls["__EVENTARGUMENT"].Value = "";
  373. fr.Controls["__CALLBACKID"].Value = "__Page";
  374. t.Request = fr;
  375. html = t.Run ();
  376. if (html.IndexOf ("Incorrect event raised callback.") < 0)
  377. Assert.Fail ("RegisterForEventValidationFail#2");
  378. }
  379. // Expected Exceptions
  380. [Test]
  381. [Category ("NotWorking")]
  382. [ExpectedException (typeof (InvalidOperationException))]
  383. public void ClientScriptManager_RegisterForEventValidationException ()
  384. {
  385. // TODO --> No RegisterForEventValidation Method
  386. // Page p = new Page ();
  387. // ClientScriptManager cs = p.ClientScript;
  388. // cs.RegisterForEventValidation ("ID", "args");
  389. }
  390. [Test]
  391. [Category ("NotWorking")]
  392. [ExpectedException (typeof (ArgumentException))]
  393. public void ClientScriptManager_ValidateEventException_1 ()
  394. {
  395. // TODO --> No ValidateEvent Method
  396. // Page p = new Page ();
  397. // ClientScriptManager cs = p.ClientScript;
  398. // cs.ValidateEvent ("Exception");
  399. }
  400. [Test]
  401. [Category ("NotWorking")]
  402. [ExpectedException (typeof (ArgumentException))]
  403. public void ClientScriptManager_ValidateEventException_2 ()
  404. {
  405. // TODO --> No ValidateEvent Method
  406. // Page p = new Page ();
  407. // ClientScriptManager cs = p.ClientScript;
  408. // cs.ValidateEvent ("Exception", "args");
  409. }
  410. [Test]
  411. [Category ("NotWorking")]
  412. [ExpectedException (typeof (ArgumentNullException))]
  413. public void ClientScriptManager_IsRegisterStartupScriptException ()
  414. {
  415. Page p = new Page ();
  416. String csname1 = "PopupScript";
  417. ClientScriptManager cs = p.ClientScript;
  418. cs.RegisterStartupScript (null, csname1, "");
  419. }
  420. [Test]
  421. [Category ("NotWorking")]
  422. [ExpectedException (typeof (ArgumentNullException))]
  423. public void ClientScriptManager_RegisterOnSubmitStatementException ()
  424. {
  425. Page p = new Page ();
  426. String csname = "OnSubmitScript";
  427. ClientScriptManager cs = p.ClientScript;
  428. String cstext = "document.write('Text from OnSubmit statement');";
  429. cs.RegisterOnSubmitStatement (null, csname, cstext);
  430. }
  431. [Test]
  432. [Category ("NotWorking")]
  433. [ExpectedException (typeof (ArgumentNullException))]
  434. public void ClientScriptManager_RegisterClientScriptIncludeException_1 ()
  435. {
  436. Page p = new Page ();
  437. String csname = "ButtonClickScript";
  438. Type cstype = p.GetType ();
  439. String csurl = "";
  440. ClientScriptManager cs = p.ClientScript;
  441. cs.RegisterClientScriptInclude (null, csname, csurl);
  442. bool registry = cs.IsClientScriptIncludeRegistered (csname);
  443. }
  444. [Test]
  445. [Category ("NotWorking")]
  446. [ExpectedException (typeof (ArgumentNullException))]
  447. public void ClientScriptManager_RegisterClientScriptIncludeException_2 ()
  448. {
  449. Page p = new Page ();
  450. String csname = "ButtonClickScript";
  451. String csurl = "ClientScript.js";
  452. ClientScriptManager cs = p.ClientScript;
  453. cs.RegisterClientScriptInclude (null, csname, csurl);
  454. bool registry = cs.IsClientScriptIncludeRegistered (csname);
  455. }
  456. [Test]
  457. [Category ("NotWorking")]
  458. [ExpectedException (typeof (ArgumentNullException))]
  459. public void ClientScriptManager_ClientScriptBlockRegisterException_2 ()
  460. {
  461. Page p = new Page ();
  462. ClientScriptManager cs = p.ClientScript;
  463. String csname2 = "ButtonClickScript";
  464. cs.RegisterClientScriptBlock (null, csname2, "");
  465. Assert.AreEqual (true, cs.IsClientScriptBlockRegistered (csname2), "ClientScriptBlockRegisterFail");
  466. }
  467. [Test]
  468. [ExpectedException (typeof (ArgumentNullException))]
  469. public void ClientScriptManager_GetWebResourceUrlException_1 ()
  470. {
  471. Page p = new Page ();
  472. ClientScriptManager cs = p.ClientScript;
  473. String cbReference = cs.GetWebResourceUrl (null, "test");
  474. }
  475. [Test]
  476. [ExpectedException (typeof (ArgumentNullException))]
  477. public void ClientScriptManager_GetWebResourceUrlException_2 ()
  478. {
  479. Page p = new Page ();
  480. ClientScriptManager cs = p.ClientScript;
  481. String cbReference = cs.GetWebResourceUrl (typeof (ClientScriptManagerTest), "");
  482. }
  483. [Test]
  484. [Category ("NotWorking")]
  485. [ExpectedException (typeof (InvalidOperationException))]
  486. public void ClientScriptManager_GetCallbackEventReferenceException_1 ()
  487. {
  488. Page p = new Page ();
  489. ClientScriptManager cs = p.ClientScript;
  490. // Define callback references.
  491. String cbReference = cs.GetCallbackEventReference (p, "arg",
  492. "ReceiveServerData1", "");
  493. }
  494. [Test]
  495. [Category ("NotWorking")]
  496. [ExpectedException (typeof (ArgumentNullException))]
  497. public void ClientScriptManager_GetCallbackEventReferenceException_2 ()
  498. {
  499. Page p = new Page ();
  500. ClientScriptManager cs = p.ClientScript;
  501. // Define callback references.
  502. String cbReference = cs.GetCallbackEventReference (null, "arg",
  503. "ReceiveServerData1", "");
  504. }
  505. [TestFixtureTearDown]
  506. public void Unload()
  507. {
  508. WebTest.Unload();
  509. }
  510. }
  511. }
  512. #endif