Beispiel #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             context.Dispose();
         }
     }
     this.disposed = true;
 }
Beispiel #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);
        }
Beispiel #3
0
 public void Dispose()
 {
     _cacheContext.SubmitChanges();
     _cacheContext.Dispose();
 }