DataTableTest.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // DataTableTest.cs - NUnit Test Cases for testing the DataTable
  2. //
  3. // Franklin Wise ([email protected])
  4. //
  5. // (C) Franklin Wise
  6. //
  7. using NUnit.Framework;
  8. using System;
  9. using System.Data;
  10. namespace MonoTests.System.Data
  11. {
  12. public class DataTableTest : TestCase
  13. {
  14. public DataTableTest() : base ("MonoTest.System.Data.DataTableTest") {}
  15. public DataTableTest(string name) : base(name) {}
  16. protected override void SetUp() {}
  17. protected override void TearDown() {}
  18. public static ITest Suite
  19. {
  20. get
  21. {
  22. return new TestSuite(typeof(DataTableTest));
  23. }
  24. }
  25. public void TestCtor()
  26. {
  27. DataTable dt = new DataTable();
  28. Assertion.AssertEquals("CaseSensitive must be false." ,false,dt.CaseSensitive);
  29. Assertion.Assert("Col",dt.Columns != null);
  30. //Assertion.Assert(dt.ChildRelations != null);
  31. Assertion.Assert("Const", dt.Constraints != null);
  32. Assertion.Assert("ds", dt.DataSet == null);
  33. Assertion.Assert("dv", dt.DefaultView != null);
  34. Assertion.Assert("de", dt.DisplayExpression == "");
  35. Assertion.Assert("ep", dt.ExtendedProperties != null);
  36. Assertion.Assert("he", dt.HasErrors == false);
  37. Assertion.Assert("lc", dt.Locale != null);
  38. Assertion.Assert("mc", dt.MinimumCapacity == 50); //LAMESPEC:
  39. Assertion.Assert("ns", dt.Namespace == "");
  40. //Assertion.Assert(dt.ParentRelations != null);
  41. Assertion.Assert("pf", dt.Prefix == "");
  42. Assertion.Assert("pk", dt.PrimaryKey != null);
  43. Assertion.Assert("rows", dt.Rows != null);
  44. Assertion.Assert("Site", dt.Site == null);
  45. Assertion.Assert("tname", dt.TableName == "");
  46. }
  47. public void TestToString()
  48. {
  49. DataTable dt = new DataTable();
  50. dt.Columns.Add("Col1",typeof(int));
  51. dt.TableName = "Myzable";
  52. dt.DisplayExpression = "Col1";
  53. string cmpr = dt.TableName + " " + dt.DisplayExpression;
  54. Assertion.AssertEquals(cmpr,dt.ToString());
  55. }
  56. }
  57. }