--- /dev/null
+// Authors:
+// Rafael Mizrahi <rafim@mainsoft.com>
+// Erez Lotan <erezl@mainsoft.com>
+// Oren Gurfinkel <oreng@mainsoft.com>
+// Ofer Borstein
+//
+// Copyright (c) 2004 Mainsoft Co.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//\r
+\r
+using NUnit.Framework;
+
+
+using System;
+using System.Data;
+
+using GHTUtils;
+using GHTUtils.Base;\r
+\r
+namespace tests.system_data_dll.System_Data
+{\r
+[TestFixture] public class RowNotInTableException_Generate : GHTBase\r
+{\r
+ [Test] public void Main()\r
+ {\r
+ RowNotInTableException_Generate tc = new RowNotInTableException_Generate();\r
+ Exception exp = null;\r
+ try\r
+ {\r
+ tc.BeginTest("RowNotInTableException");\r
+ tc.run();\r
+ }\r
+ catch(Exception ex)\r
+ {\r
+ exp = ex;\r
+ }\r
+ finally\r
+ {\r
+ tc.EndTest(exp);\r
+ }\r
+ }\r
+\r
+ //Activate This Construntor to log All To Standard output\r
+ //public TestClass():base(true){}\r
+\r
+ //Activate this constructor to log Failures to a log file\r
+ //public TestClass(System.IO.TextWriter tw):base(tw, false){}\r
+\r
+\r
+ //Activate this constructor to log All to a log file\r
+ //public TestClass(System.IO.TextWriter tw):base(tw, true){}\r
+\r
+ //BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES\r
+\r
+ public void run()\r
+ {\r
+ Exception exp = null;\r
+ Exception tmpEx = new Exception() ;\r
+\r
+ DataSet ds = new DataSet();\r
+ ds.Tables.Add(GHTUtils.DataProvider.CreateParentDataTable());\r
+ ds.Tables.Add(GHTUtils.DataProvider.CreateChildDataTable());\r
+ ds.Relations.Add(new DataRelation("myRelation",ds.Tables[0].Columns[0],ds.Tables[1].Columns[0]));\r
+\r
+ DataRow drParent = ds.Tables[0].Rows[0];\r
+ DataRow drChild = ds.Tables[1].Rows[0];\r
+ drParent.Delete();\r
+ drChild.Delete();\r
+ ds.AcceptChanges();\r
+ \r
+ try\r
+ {\r
+ BeginCase("RowNotInTableException - AcceptChanges");\r
+ try\r
+ {\r
+ drParent.AcceptChanges();\r
+ }\r
+ catch (RowNotInTableException ex)\r
+ {\r
+ tmpEx = ex;\r
+ }\r
+ base.Compare(tmpEx.GetType(),typeof(RowNotInTableException));\r
+ tmpEx = new Exception();\r
+ }\r
+ catch(Exception ex) {exp = ex;}\r
+ finally {EndCase(exp); exp = null;}\r
+\r
+ try\r
+ {\r
+ BeginCase("RowNotInTableException - GetChildRows");\r
+ try\r
+ {\r
+ drParent.GetChildRows("myRelation");\r
+ }\r
+ catch (RowNotInTableException ex)\r
+ {\r
+ tmpEx = ex;\r
+ }\r
+ base.Compare(tmpEx.GetType(),typeof(RowNotInTableException));\r
+ tmpEx = new Exception();\r
+ }\r
+ catch(Exception ex) {exp = ex;}\r
+ finally {EndCase(exp); exp = null;}\r
+\r
+ try\r
+ {\r
+ BeginCase("RowNotInTableException - ItemArray");\r
+ object[] o = null;\r
+ try\r
+ {\r
+ o = drParent.ItemArray ;\r
+ }\r
+ catch (RowNotInTableException ex)\r
+ {\r
+ tmpEx = ex;\r
+ }\r
+ base.Compare(tmpEx.GetType(),typeof(RowNotInTableException));\r
+ tmpEx = new Exception();\r
+ }\r
+ catch(Exception ex) {exp = ex;}\r
+ finally {EndCase(exp); exp = null;}\r
+\r
+ // ********** don't throw exception (should be according to MSDN) ***********************\r
+ // try\r
+ // {\r
+ // BeginCase("RowNotInTableException - GetParentRow");\r
+ // DataRow dr = null;\r
+ // try\r
+ // {\r
+ // dr = drChild.GetParentRow("myRelation"); \r
+ // }\r
+ // catch (RowNotInTableException ex)\r
+ // {\r
+ // tmpEx = ex;\r
+ // }\r
+ // base.Compare(tmpEx.GetType(),typeof(RowNotInTableException));\r
+ // tmpEx = new Exception();\r
+ // }\r
+ // catch(Exception ex) {exp = ex;}\r
+ // finally {EndCase(exp); exp = null;}\r
+ \r
+ try\r
+ {\r
+ BeginCase("RowNotInTableException - GetParentRows");\r
+ DataRow[] dr = null;\r
+ try\r
+ {\r
+ dr = drChild.GetParentRows("myRelation"); \r
+ }\r
+ catch (RowNotInTableException ex)\r
+ {\r
+ tmpEx = ex;\r
+ }\r
+ base.Compare(tmpEx.GetType(),typeof(RowNotInTableException));\r
+ tmpEx = new Exception();\r
+ }\r
+ catch(Exception ex) {exp = ex;}\r
+ finally {EndCase(exp); exp = null;}\r
+\r
+ try\r
+ {\r
+ BeginCase("RowNotInTableException - RejectChanges");\r
+ try\r
+ {\r
+ drParent.RejectChanges();\r
+ }\r
+ catch (RowNotInTableException ex)\r
+ {\r
+ tmpEx = ex;\r
+ }\r
+ base.Compare(tmpEx.GetType(),typeof(RowNotInTableException));\r
+ tmpEx = new Exception();\r
+ }\r
+ catch(Exception ex) {exp = ex;}\r
+ finally {EndCase(exp); exp = null;}\r
+\r
+ try\r
+ {\r
+ BeginCase("RowNotInTableException - SetParentRow");\r
+ try\r
+ {\r
+ drChild.SetParentRow(ds.Tables[0].Rows[1]);\r
+ }\r
+ catch (RowNotInTableException ex)\r
+ {\r
+ tmpEx = ex;\r
+ }\r
+ base.Compare(tmpEx.GetType(),typeof(RowNotInTableException));\r
+ tmpEx = new Exception();\r
+ }\r
+ catch(Exception ex) {exp = ex;}\r
+ finally {EndCase(exp); exp = null;}\r
+ }\r
+}\r
+}
\ No newline at end of file