2
0

WebPartTest.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // Tests for System.Web.UI.WebControls.WebParts.PartTest
  3. //
  4. // Author:
  5. // Chris Toshok ([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. //
  29. #if NET_2_0
  30. using System;
  31. using NUnit.Framework;
  32. using System.Web.UI.WebControls;
  33. using System.Web.UI.WebControls.WebParts;
  34. namespace MonoTests.System.Web.UI.WebControls.WebParts {
  35. [TestFixture]
  36. public class WebPartTest {
  37. class Poker : WebPart {
  38. public void TrackState ()
  39. {
  40. TrackViewState();
  41. }
  42. public object SaveState ()
  43. {
  44. return SaveViewState();
  45. }
  46. public void LoadState (object o)
  47. {
  48. LoadViewState(o);
  49. }
  50. }
  51. [Test]
  52. [Category ("NotWorking")]
  53. public void Defaults ()
  54. {
  55. Poker p = new Poker ();
  56. Assert.AreEqual (p.AllowClose, true, "A1");
  57. Assert.AreEqual (p.AllowConnect, true, "A2");
  58. Assert.AreEqual (p.AllowEdit, true, "A3");
  59. Assert.AreEqual (p.AllowHide, true, "A4");
  60. Assert.AreEqual (p.AllowMinimize, true, "A5");
  61. Assert.AreEqual (p.AllowZoneChange, true, "A6");
  62. Assert.AreEqual (p.AuthorizationFilter, String.Empty, "A7");
  63. Assert.AreEqual (p.CatalogIconImageUrl, String.Empty, "A8");
  64. Assert.AreEqual (p.ChromeState, PartChromeState.Normal, "A9");
  65. Assert.AreEqual (p.ChromeType, PartChromeType.Default, "A10");
  66. Assert.AreEqual (p.ConnectErrorMessage, String.Empty, "A11");
  67. Assert.AreEqual (p.Description, String.Empty, "A12");
  68. /* Direction - A13 */
  69. Assert.AreEqual (p.DisplayTitle, "Untitled", "A14");
  70. Assert.AreEqual (p.ExportMode, WebPartExportMode.None, "A15");
  71. Assert.AreEqual (p.HasSharedData, false, "A16");
  72. Assert.AreEqual (p.HasUserData, false, "A17");
  73. Assert.AreEqual (p.Height, Unit.Empty, "A18");
  74. Assert.AreEqual (p.HelpMode, WebPartHelpMode.Navigate, "A19");
  75. Assert.AreEqual (p.HelpUrl, String.Empty, "A20");
  76. Assert.AreEqual (p.Hidden, false, "A21");
  77. Assert.AreEqual (p.ImportErrorMessage, "Cannot import this Web Part.", "A22");
  78. Assert.AreEqual (p.IsClosed, false, "A23");
  79. Assert.AreEqual (p.IsShared, false, "A24");
  80. Assert.AreEqual (p.IsStandalone, true, "A25");
  81. /* this next isn't really a default - it's true
  82. * because the part was created programmatically */
  83. Assert.AreEqual (p.IsStatic, true, "A26");
  84. Assert.AreEqual (p.Subtitle, String.Empty, "A27");
  85. Assert.AreEqual (p.Title, String.Empty, "A28");
  86. Assert.AreEqual (p.TitleIconImageUrl, String.Empty, "A29");
  87. Assert.AreEqual (p.TitleUrl, String.Empty, "A30");
  88. Assert.IsNotNull (p.Verbs, "A31");
  89. #if IWebEditableInterface
  90. Assert.AreEqual (p.WebBrowsableObject, null, "A32");
  91. #endif
  92. #if notyet
  93. Assert.AreEqual (p.WebPartManager, null, "A33");
  94. #endif
  95. Assert.AreEqual (p.Width, Unit.Empty, "A34");
  96. Assert.AreEqual (p.ZoneIndex, 0, "A35");
  97. }
  98. }
  99. }
  100. #endif