Ejemplo n.º 1
0
        public void FreeIDictionaryInIDictionary()
        {
            Func <IObjectDBTransaction, ILinksInIDict> creator;

            using (var tr = _db.StartTransaction())
            {
                creator = tr.InitRelation <ILinksInIDict>("IDictLinksRelation");
                var links = creator(tr);
                var link  = new LinkInIDict
                {
                    Id         = 1,
                    EdgesIDict = new Dictionary <int, IDictionary <ulong, ulong> >
                    {
                        [0] = new Dictionary <ulong, ulong> {
                            [0] = 1, [1] = 2, [2] = 3
                        },
                        [1] = new Dictionary <ulong, ulong> {
                            [0] = 1, [1] = 2, [2] = 3
                        }
                    }
                };
                links.Insert(link);
                tr.Commit();
            }

            AssertNoLeaksInDb();
            using (var tr = _db.StartTransaction())
            {
                var links = creator(tr);
                Assert.True(links.RemoveById(1));
                tr.Commit();
            }

            AssertNoLeaksInDb();
        }
Ejemplo n.º 2
0
 public void FreeIDictionaryInIDictionary()
 {
     Func<IObjectDBTransaction, ILinksInIDict> creator;
     using (var tr = _db.StartTransaction())
     {
         creator = tr.InitRelation<ILinksInIDict>("IDictLinksRelation");
         var links = creator(tr);
         var link = new LinkInIDict
         {
             Id = 1,
             EdgesIDict = new Dictionary<int, IDictionary<ulong, ulong>>
             {
                 [0] = new Dictionary<ulong, ulong> { [0] = 1, [1] = 2, [2] = 3 },
                 [1] = new Dictionary<ulong, ulong> { [0] = 1, [1] = 2, [2] = 3 }
             }
         };
         links.Insert(link);
         tr.Commit();
     }
     AssertNoLeaksInDb();
     using (var tr = _db.StartTransaction())
     {
         var links = creator(tr);
         Assert.True(links.RemoveById(1));
         tr.Commit();
     }
     AssertNoLeaksInDb();
 }