FormViewTest.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. //
  2. // Tests for System.Web.UI.WebControls.FormView.cs
  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 NUnit.Framework;
  31. using System;
  32. using System.IO;
  33. using System.Globalization;
  34. using System.Web;
  35. using System.Web.UI;
  36. using System.Web.UI.WebControls;
  37. namespace MonoTests.System.Web.UI.WebControls
  38. {
  39. [TestFixture]
  40. public class FormViewTest {
  41. class Poker : FormView {
  42. public Poker () {
  43. TrackViewState ();
  44. }
  45. public object SaveState () {
  46. return SaveViewState ();
  47. }
  48. public void LoadState (object state) {
  49. LoadViewState (state);
  50. }
  51. }
  52. [Test]
  53. public void Defaults ()
  54. {
  55. Poker p = new Poker ();
  56. Assert.IsFalse (p.AllowPaging, "A1");
  57. Assert.AreEqual ("", p.BackImageUrl, "A2");
  58. Assert.IsNull (p.BottomPagerRow, "A3");
  59. Assert.AreEqual ("", p.Caption, "A4");
  60. Assert.AreEqual (TableCaptionAlign.NotSet, p.CaptionAlign ,"A5");
  61. Assert.AreEqual (-1, p.CellPadding, "A6");
  62. Assert.AreEqual (0, p.CellSpacing, "A7");
  63. Assert.AreEqual (FormViewMode.ReadOnly, p.CurrentMode, "A8");
  64. Assert.AreEqual (FormViewMode.ReadOnly, p.DefaultMode, "A9");
  65. Assert.IsNotNull (p.DataKeyNames, "A10");
  66. Assert.AreEqual (0, p.DataKeyNames.Length, "A10.1");
  67. Assert.IsNotNull (p.DataKey, "A11");
  68. Assert.AreEqual (0, p.DataKey.Values.Count, "A11.1");
  69. Assert.IsNull (p.EditItemTemplate, "A12");
  70. Assert.IsNotNull (p.EditRowStyle, "A13");
  71. Assert.IsTrue (Style.IsStyleEmpty (p.EditRowStyle), "A13.1");
  72. Assert.IsNotNull (p.EmptyDataRowStyle, "A14");
  73. Assert.IsTrue (Style.IsStyleEmpty (p.EmptyDataRowStyle), "A14.1");
  74. Assert.IsNull (p.EmptyDataTemplate, "A15");
  75. Assert.AreEqual ("", p.EmptyDataText, "A16");
  76. Assert.IsNull (p.FooterRow, "A17");
  77. Assert.IsNull (p.FooterTemplate, "A18");
  78. Assert.AreEqual ("", p.FooterText, "A19");
  79. Assert.IsNotNull (p.FooterStyle, "A20");
  80. Assert.IsTrue (Style.IsStyleEmpty (p.FooterStyle), "A20.1");
  81. Assert.AreEqual (GridLines.None, p.GridLines, "A21");
  82. Assert.IsNull (p.HeaderRow, "A22");
  83. Assert.IsNotNull (p.HeaderStyle, "A23");
  84. Assert.IsTrue (Style.IsStyleEmpty (p.HeaderStyle), "A23.1");
  85. Assert.IsNull (p.HeaderTemplate, "A24");
  86. Assert.AreEqual ("", p.HeaderText, "A25");
  87. Assert.AreEqual (HorizontalAlign.NotSet, p.HorizontalAlign, "A26");
  88. Assert.IsNull (p.InsertItemTemplate, "A27");
  89. Assert.IsNotNull (p.InsertRowStyle, "A28");
  90. Assert.IsTrue (Style.IsStyleEmpty (p.InsertRowStyle), "A28.1");
  91. Assert.IsNull (p.ItemTemplate, "A29");
  92. Assert.AreEqual (0, p.PageCount, "A30");
  93. Assert.AreEqual (0, p.PageIndex, "A31");
  94. Assert.IsNull (p.PagerTemplate, "A32");
  95. Assert.IsNull (p.Row, "A33");
  96. Assert.IsNotNull (p.RowStyle, "A34");
  97. Assert.IsTrue (Style.IsStyleEmpty (p.RowStyle), "A34.1");
  98. Assert.IsNull (p.SelectedValue, "A35");
  99. Assert.IsNull (p.TopPagerRow, "A36");
  100. Assert.IsNull (p.DataItem, "A37");
  101. Assert.AreEqual (0, p.DataItemCount, "A38");
  102. Assert.AreEqual (0, p.DataItemIndex, "A39");
  103. }
  104. }
  105. }
  106. #endif