예제 #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             context.Dispose();
         }
     }
     this.disposed = true;
 }
예제 #2
0
        public void SQLite__Insert_Rows(string serializedSignal, DateTime timestamp)
        {
            // Prepare
            CacheContext db = this.GetService <CacheContext>();

            // Pre-validate

            // Perform
            int countBefore = db.Signals.Count();

            db.Signals.Add(Signal.New(deviceId: "fooDevice", data: serializedSignal, timestamp: timestamp));
            db.SaveChanges();
            db.Dispose();

            int    countAfter = db.Signals.Count();
            string lastData   = db.Signals.Last().Data;

            db.Dispose();

            // Post-Validate
            Assert.Equal(countBefore + 1, countAfter); // signal inserted correctly
            Assert.Equal(serializedSignal, lastData);
        }
예제 #3
0
 public void Dispose()
 {
     _cacheContext.SubmitChanges();
     _cacheContext.Dispose();
 }