//Activate This Construntor to log All To Standard output //public TestClass():base(true){} //Activate this constructor to log Failures to a log file //public TestClass(System.IO.TextWriter tw):base(tw, false){} //Activate this constructor to log All to a log file //public TestClass(System.IO.TextWriter tw):base(tw, true){} //BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES public void run() { Exception exp = null; DataColumn dc1; int iHashCode1; dc1 = new DataColumn(); iHashCode1 = dc1.GetHashCode(); for (int i=0; i<10; i++) { //must return the same value each time try { BeginCase("GetHashCode #" + i.ToString()); Compare(iHashCode1 , dc1.GetHashCode()); } catch(Exception ex) {exp = ex;} finally {EndCase(exp); exp = null;} } }
// must override GetHashCode if Equals is redefined public override int GetHashCode() { return(Column.GetHashCode() ^ IsDescending.GetHashCode()); }
[Test] public void TestGetHashCode() { DataColumn dc1; int iHashCode1; dc1 = new DataColumn(); iHashCode1 = dc1.GetHashCode(); for (int i=0; i<10; i++) { // must return the same value each time // GetHashCode #" + i.ToString()); Assert.AreEqual(dc1.GetHashCode(), iHashCode1 , "DC27"); } }
// must override GetHashCode if Equals is redefined public override int GetHashCode() => Column.GetHashCode() ^ IsDescending.GetHashCode();