2 // Rafael Mizrahi <rafim@mainsoft.com>
3 // Erez Lotan <erezl@mainsoft.com>
4 // Oren Gurfinkel <oreng@mainsoft.com>
7 // Copyright (c) 2004 Mainsoft Co.
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 using NUnit.Framework;
37 namespace tests.system_data_dll.System_Data
39 [TestFixture] public class DataRow_HasVersion_D : GHTBase
48 catch(Exception ex) {exp = ex;}
49 finally {EndCase(exp); exp = null;}
52 public void TearDown()
56 [Test] public void Main()
58 DataRow_HasVersion_D tc = new DataRow_HasVersion_D();
62 tc.BeginTest("DataRow_HasVersion_D");
83 DataTable t = new DataTable("atable");
84 t.Columns.Add("id", typeof(int));
85 t.Columns.Add("name", typeof(string));
86 t.Columns[0].DefaultValue = 1;
87 t.Columns[1].DefaultValue = "something";
91 DataRow r = t.NewRow();
95 BeginCase("HasVersion Test #10");
96 Compare(r.HasVersion(DataRowVersion.Current) ,false );
98 catch(Exception ex) {exp = ex;}
99 finally {EndCase(exp); exp = null;}
103 BeginCase("HasVersion Test #11");
104 Compare(r.HasVersion(DataRowVersion.Original) ,false );
106 catch(Exception ex) {exp = ex;}
107 finally {EndCase(exp); exp = null;}
111 BeginCase("HasVersion Test #12");
112 Compare(r.HasVersion(DataRowVersion.Default) ,true );
114 catch(Exception ex) {exp = ex;}
115 finally {EndCase(exp); exp = null;}
119 BeginCase("HasVersion Test #13");
120 Compare(r.HasVersion(DataRowVersion.Proposed) ,true );
122 catch(Exception ex) {exp = ex;}
123 finally {EndCase(exp); exp = null;}
131 BeginCase("HasVersion Test #20");
132 Compare(r.HasVersion(DataRowVersion.Current) ,false );
134 catch(Exception ex) {exp = ex;}
135 finally {EndCase(exp); exp = null;}
139 BeginCase("HasVersion Test #21");
140 Compare(r.HasVersion(DataRowVersion.Original) ,false );
142 catch(Exception ex) {exp = ex;}
143 finally {EndCase(exp); exp = null;}
147 BeginCase("HasVersion Test #22");
148 Compare(r.HasVersion(DataRowVersion.Default) ,true );
150 catch(Exception ex) {exp = ex;}
151 finally {EndCase(exp); exp = null;}
155 BeginCase("HasVersion Test #23");
156 Compare(r.HasVersion(DataRowVersion.Proposed) ,true );
158 catch(Exception ex) {exp = ex;}
159 finally {EndCase(exp); exp = null;}
166 BeginCase("HasVersion Test #30");
167 Compare(r.HasVersion(DataRowVersion.Current) ,true );
169 catch(Exception ex) {exp = ex;}
170 finally {EndCase(exp); exp = null;}
174 BeginCase("HasVersion Test #31");
175 Compare(r.HasVersion(DataRowVersion.Original) ,false );
177 catch(Exception ex) {exp = ex;}
178 finally {EndCase(exp); exp = null;}
182 BeginCase("HasVersion Test #32");
183 Compare(r.HasVersion(DataRowVersion.Default) ,true );
185 catch(Exception ex) {exp = ex;}
186 finally {EndCase(exp); exp = null;}
190 BeginCase("HasVersion Test #33");
191 Compare(r.HasVersion(DataRowVersion.Proposed) ,false );
193 catch(Exception ex) {exp = ex;}
194 finally {EndCase(exp); exp = null;}
198 // now it is "unchanged"
202 BeginCase("HasVersion Test #40");
203 Compare(r.HasVersion(DataRowVersion.Current) ,true );
205 catch(Exception ex) {exp = ex;}
206 finally {EndCase(exp); exp = null;}
210 BeginCase("HasVersion Test #41");
211 Compare(r.HasVersion(DataRowVersion.Original) ,true );
213 catch(Exception ex) {exp = ex;}
214 finally {EndCase(exp); exp = null;}
218 BeginCase("HasVersion Test #42");
219 Compare(r.HasVersion(DataRowVersion.Default) ,true );
221 catch(Exception ex) {exp = ex;}
222 finally {EndCase(exp); exp = null;}
226 BeginCase("HasVersion Test #43");
227 Compare(r.HasVersion(DataRowVersion.Proposed) ,false );
229 catch(Exception ex) {exp = ex;}
230 finally {EndCase(exp); exp = null;}
238 BeginCase("HasVersion Test #50");
239 Compare(r.HasVersion(DataRowVersion.Current) ,true );
241 catch(Exception ex) {exp = ex;}
242 finally {EndCase(exp); exp = null;}
246 BeginCase("HasVersion Test #51");
247 Compare(r.HasVersion(DataRowVersion.Original) ,true );
249 catch(Exception ex) {exp = ex;}
250 finally {EndCase(exp); exp = null;}
254 BeginCase("HasVersion Test #52");
255 Compare(r.HasVersion(DataRowVersion.Default) ,true );
257 catch(Exception ex) {exp = ex;}
258 finally {EndCase(exp); exp = null;}
262 BeginCase("HasVersion Test #53");
263 Compare(r.HasVersion(DataRowVersion.Proposed) ,true );
265 catch(Exception ex) {exp = ex;}
266 finally {EndCase(exp); exp = null;}
270 // now it is "modified"
273 BeginCase("HasVersion Test #60");
274 Compare(r.HasVersion(DataRowVersion.Current) ,true );
276 catch(Exception ex) {exp = ex;}
277 finally {EndCase(exp); exp = null;}
281 BeginCase("HasVersion Test #61");
282 Compare(r.HasVersion(DataRowVersion.Original) ,true );
284 catch(Exception ex) {exp = ex;}
285 finally {EndCase(exp); exp = null;}
289 BeginCase("HasVersion Test #62");
290 Compare(r.HasVersion(DataRowVersion.Default) ,true );
292 catch(Exception ex) {exp = ex;}
293 finally {EndCase(exp); exp = null;}
297 BeginCase("HasVersion Test #63");
298 Compare(r.HasVersion(DataRowVersion.Proposed) ,false );
300 catch(Exception ex) {exp = ex;}
301 finally {EndCase(exp); exp = null;}
303 // this or t.AcceptChanges
305 // now it is "unchanged" again
308 BeginCase("HasVersion Test #70");
309 Compare(r.HasVersion(DataRowVersion.Current) ,true );
311 catch(Exception ex) {exp = ex;}
312 finally {EndCase(exp); exp = null;}
316 BeginCase("HasVersion Test #71");
317 Compare(r.HasVersion(DataRowVersion.Original) ,true );
319 catch(Exception ex) {exp = ex;}
320 finally {EndCase(exp); exp = null;}
324 BeginCase("HasVersion Test #72");
325 Compare(r.HasVersion(DataRowVersion.Default) ,true );
327 catch(Exception ex) {exp = ex;}
328 finally {EndCase(exp); exp = null;}
332 BeginCase("HasVersion Test #73");
333 Compare(r.HasVersion(DataRowVersion.Proposed) ,false );
335 catch(Exception ex) {exp = ex;}
336 finally {EndCase(exp); exp = null;}
339 // now it is "deleted"
343 BeginCase("HasVersion Test #80");
344 Compare(r.HasVersion(DataRowVersion.Current) ,false );
346 catch(Exception ex) {exp = ex;}
347 finally {EndCase(exp); exp = null;}
351 BeginCase("HasVersion Test #81");
352 Compare(r.HasVersion(DataRowVersion.Original) ,true );
354 catch(Exception ex) {exp = ex;}
355 finally {EndCase(exp); exp = null;}
359 BeginCase("HasVersion Test #82");
360 Compare(r.HasVersion(DataRowVersion.Default) ,false );
362 catch(Exception ex) {exp = ex;}
363 finally {EndCase(exp); exp = null;}
367 BeginCase("HasVersion Test #83");
368 Compare(r.HasVersion(DataRowVersion.Proposed) ,false );
370 catch(Exception ex) {exp = ex;}
371 finally {EndCase(exp); exp = null;}
378 BeginCase("HasVersion Test #90");
379 Compare(r.HasVersion(DataRowVersion.Current) ,false );
381 catch(Exception ex) {exp = ex;}
382 finally {EndCase(exp); exp = null;}
386 BeginCase("HasVersion Test #91");
387 Compare(r.HasVersion(DataRowVersion.Original) ,false );
389 catch(Exception ex) {exp = ex;}
390 finally {EndCase(exp); exp = null;}
394 BeginCase("HasVersion Test #92");
395 Compare(r.HasVersion(DataRowVersion.Default) ,false );
397 catch(Exception ex) {exp = ex;}
398 finally {EndCase(exp); exp = null;}
402 BeginCase("HasVersion Test #93");
403 Compare(r.HasVersion(DataRowVersion.Proposed) ,false );
405 catch(Exception ex) {exp = ex;}
406 finally {EndCase(exp); exp = null;}