2
0

TreeViewTest.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //
  2. // System.Web.UI.WebControls.TreeViewTest.cs
  3. // - Unit tests for System.Web.UI.Webcontrols.TreeView
  4. //
  5. //
  6. // Authors:
  7. // Chris Toshok ([email protected])
  8. //
  9. // (C) 2005 Novell, Inc (http://www.novell.com)
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. //
  30. //
  31. #if NET_2_0
  32. using System;
  33. using System.IO;
  34. using System.Web.UI;
  35. using System.Web.UI.WebControls;
  36. using NUnit.Framework;
  37. namespace MonoTests.System.Web.UI.WebControls {
  38. public class TreeViewPoker : TreeView {
  39. }
  40. [TestFixture]
  41. public class TreeViewTest {
  42. [Test]
  43. public void Defaults ()
  44. {
  45. TreeViewPoker p = new TreeViewPoker ();
  46. Assert.AreEqual ("Collapse {0}", p.CollapseImageToolTip, "A1");
  47. Assert.IsTrue (p.AutoGenerateDataBindings, "A2");
  48. Assert.AreEqual ("", p.CollapseImageUrl, "A3");
  49. Assert.IsNotNull (p.DataBindings, "A4");
  50. Assert.AreEqual (0, p.DataBindings.Count, "A4.1");
  51. Assert.IsTrue (p.EnableClientScript, "A5");
  52. Assert.AreEqual (-1, p.ExpandDepth, "A6");
  53. Assert.AreEqual ("Expand {0}", p.ExpandImageToolTip, "A7");
  54. Assert.AreEqual ("", p.ExpandImageUrl, "A8");
  55. Assert.IsNotNull (p.HoverNodeStyle, "A9");
  56. Assert.AreEqual (TreeViewImageSet.Custom, p.ImageSet, "A10");
  57. Assert.IsNotNull (p.LeafNodeStyle, "A11");
  58. Assert.IsNotNull (p.LevelStyles, "A12");
  59. Assert.AreEqual (0, p.LevelStyles.Count, "A12.1");
  60. Assert.AreEqual ("", p.LineImagesFolder, "A13");
  61. Assert.AreEqual (-1, p.MaxDataBindDepth, "A14");
  62. Assert.AreEqual (20, p.NodeIndent, "A15");
  63. Assert.IsNotNull (p.Nodes, "A16");
  64. Assert.AreEqual (0, p.Nodes.Count, "A16.1");
  65. Assert.IsNotNull (p.NodeStyle, "A17");
  66. Assert.IsFalse (p.NodeWrap, "A18");
  67. Assert.AreEqual ("", p.NoExpandImageUrl, "A19");
  68. Assert.IsNotNull (p.ParentNodeStyle, "A20");
  69. Assert.AreEqual ('/', p.PathSeparator, "A21");
  70. Assert.IsTrue (p.PopulateNodesFromClient, "A22");
  71. Assert.IsNotNull (p.RootNodeStyle, "A23");
  72. Assert.IsNotNull (p.SelectedNodeStyle, "A24");
  73. Assert.AreEqual (TreeNodeTypes.None, p.ShowCheckBoxes, "A25");
  74. Assert.IsTrue (p.ShowExpandCollapse, "A26");
  75. Assert.AreEqual ("Skip Navigation Links.", p.SkipLinkText, "A27");
  76. Assert.IsNull (p.SelectedNode, "A28");
  77. Assert.AreEqual ("", p.SelectedValue, "A29");
  78. Assert.AreEqual ("", p.Target, "A30");
  79. Assert.IsTrue (p.Visible, "A31");
  80. }
  81. [Test]
  82. public void DefaultStyles()
  83. {
  84. TreeViewPoker p = new TreeViewPoker ();
  85. Assert.IsTrue (Style.IsStyleEmpty (p.HoverNodeStyle), "A1");
  86. Assert.IsTrue (Style.IsStyleEmpty (p.LeafNodeStyle), "A2");
  87. Assert.IsTrue (Style.IsStyleEmpty (p.NodeStyle), "A3");
  88. Assert.IsTrue (Style.IsStyleEmpty (p.ParentNodeStyle), "A4");
  89. Assert.IsTrue (Style.IsStyleEmpty (p.RootNodeStyle), "A5");
  90. Assert.IsTrue (Style.IsStyleEmpty (p.SelectedNodeStyle), "A6");
  91. }
  92. }
  93. }
  94. #endif