//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; DataTable dtParent = GHTUtils.DataProvider.CreateParentDataTable(); DataTable dtChild = GHTUtils.DataProvider.CreateChildDataTable(); ForeignKeyConstraint fc = null; fc = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]); try { BeginCase("ToString - default"); Compare(fc.ToString(), string.Empty ); } catch(Exception ex) {exp = ex;} finally {EndCase(exp); exp = null;} fc = new ForeignKeyConstraint("myConstraint",dtParent.Columns[0],dtChild.Columns[0]); try { BeginCase("Tostring - Constraint name"); Compare(fc.ToString(), "myConstraint"); } catch(Exception ex) {exp = ex;} finally {EndCase(exp); exp = null;} }
[Test] public new void ToString() { DataTable dtParent = DataProvider.CreateParentDataTable(); DataTable dtChild = DataProvider.CreateChildDataTable(); ForeignKeyConstraint fc = null; fc = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]); // ToString - default Assert.AreEqual(string.Empty , fc.ToString(), "FKC8"); fc = new ForeignKeyConstraint("myConstraint",dtParent.Columns[0],dtChild.Columns[0]); // Tostring - Constraint name Assert.AreEqual("myConstraint", fc.ToString(), "FKC9"); }