1. vadimtsushko
  2. mongo-dart

Source

mongo-dart / tests / objectory / PersistentObjectTest.dart

Diff from to

File tests/objectory/PersistentObjectTest.dart

 #library("PersistenObjectTests");
 #import("../../lib/objectory/ObjectoryLib_vm.dart");
+#import("../../lib/bson/bson.dart");
 #import('../../third_party/testing/unittest/unittest_vm.dart');
 #source("DomainModel.dart");
 testAuthorCreation(){
   expect(person.isDirty()).isTrue();
   expect(person.address.isDirty()).isTrue();
 }
+testFailOnSettingUnsavedLinkObject(){
+  Person son = new Person();  
+  Person father = new Person();  
+  ;
+  Expect.throws(()=>son.father = father,reason:"Link object must be saved (have ObjectId)");
+}  
 testFailOnAbsentProperty(){
   IAuthor author = new Author();
   Expect.throws(()=>author.sdfsdfsdfgdfgdf,reason:"Must fail on missing property getter");
 }
 
 main(){
+  registerClasses();  
   group("PersistenObjectTests", ()  {
     test("testAuthorCreation",testAuthorCreation);
     test("testSetDirty",testSetDirty);
     test("testCompoundObject",testCompoundObject);
     test("testFailOnAbsentProperty",testFailOnAbsentProperty);
+    test("testFailOnSettingUnsavedLinkObject",testFailOnSettingUnsavedLinkObject);    
   });  
 
 }