Example #1
0
 public void MultiContextCloneLinkTest( )
 {
     using (var mergedMod = new NativeModule( ))
         using (var m1 = CreateSimpleModule("module1"))
             using (var m2 = CreateSimpleModule("module2"))
             {
                 Assert.AreNotSame(mergedMod.Context, m1.Context);
                 Assert.AreNotSame(mergedMod.Context, m2.Context);
                 var clone1 = m1.Clone(mergedMod.Context);
                 var clone2 = m2.Clone(mergedMod.Context);
                 GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true);
                 mergedMod.Link(clone1);
                 GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true);
                 Assert.IsTrue(mergedMod.Verify(out string errMsg), errMsg);
                 Assert.AreEqual(1, mergedMod.Functions.Count( ));
                 mergedMod.Link(clone2);
                 GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true);
                 Assert.IsTrue(mergedMod.Verify(out errMsg), errMsg);
                 Assert.AreEqual(2, mergedMod.Functions.Count( ));
             }
 }