2 // System.Data.ObjectSpaces.CommonObjectContextTests.cs
5 // Tim Coleman (tim@timcoleman.com)
7 // Copyright (C) Tim Coleman, 2003
13 using System
.Data
.ObjectSpaces
;
14 using System
.Data
.ObjectSpaces
.Schema
;
15 using NUnit
.Framework
;
17 namespace MonoTests
.System
.Data
.ObjectSpaces
20 public class CommonObjectContextTests
: Assertion
22 CommonObjectContext context
;
25 public void GetReady ()
27 ObjectSchema schema
= new ObjectSchema ();
28 context
= new CommonObjectContext (schema
);
36 Fail ("Expected a ContextException to be thrown.");
37 } catch (ContextException
) {}
41 Fail ("Expected a NullReferenceException to be thrown.");
42 } catch (NullReferenceException
) {}
49 context
.Add (null, ObjectState
.Unknown
);
50 Fail ("Expected a ContextException to be thrown.");
51 } catch (ContextException
) {}
54 context
.Add ("add2", (ObjectState
) (-1));
55 Fail ("Expected a NullReferenceException to be thrown.");
56 } catch (NullReferenceException
) {}
59 context
.Add ("add2", ObjectState
.Unknown
);
60 Fail ("Expected a ContextException to be thrown.");
61 } catch (ContextException
) {}
63 context
.Add ("add2", ObjectState
.Inserted
);
70 context
.Delete (null);
71 Fail ("Expected an ArgumentNullException to be thrown.");
72 } catch (ArgumentNullException
) {}