Dispose() публичный Метод

public Dispose ( ) : void
Результат void
Пример #1
0
        public void DateUtcIsCorrectlyStored()
        {
            DbStorage storage = new DbStorage(connFactory, testUser.Username);

            var tomboy_note = new Note ();
            tomboy_note.ChangeDate = new DateTime (2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            tomboy_note.CreateDate = tomboy_note.ChangeDate;
            tomboy_note.MetadataChangeDate = tomboy_note.ChangeDate;

            storage.SaveNote (tomboy_note);
            var stored_note = storage.GetNotes ().Values.First ();

            storage.Dispose ();

            Assert.AreEqual (tomboy_note.ChangeDate, stored_note.ChangeDate.ToUniversalTime ());
        }
Пример #2
0
        public void DateUtcIsCorrectlyStored()
        {
            DbStorage storage = new DbStorage(testUser);

            var tomboy_note = new Note();

            tomboy_note.ChangeDate         = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            tomboy_note.CreateDate         = tomboy_note.ChangeDate;
            tomboy_note.MetadataChangeDate = tomboy_note.ChangeDate;

            storage.SaveNote(tomboy_note);
            var stored_note = storage.GetNotes().Values.First();

            storage.Dispose();

            Assert.AreEqual(tomboy_note.ChangeDate, stored_note.ChangeDate.ToUniversalTime());
        }
Пример #3
0
        public void NoteIsEncryptedIsCorrectlySet()
        {
            // test with encrypted notes
            DbStorage storage = new DbEncryptedStorage (this.connFactory, this.testUser, key);
            var sample_notes = DbStorageTests.GetSampleNotes ();
            foreach(var note in sample_notes) {
                storage.SaveNote (note);
            }
            storage.Dispose ();

            foreach(var note in sample_notes) {
                // the stored notes should only contain hex chars
                using (var db = connFactory.OpenDbConnection ()) {
                    var db_note = db.First<DBNote> (n => n.Guid == note.Guid);
                    // this will fail if any non-hex chars are in
                    Assert.IsTrue (db_note.IsEncypted);
                }
            }

            storage = new DbStorage (this.connFactory, this.testUser.Username);
            sample_notes = DbStorageTests.GetSampleNotes ();
            foreach(var note in sample_notes) {
                storage.SaveNote (note);
            }
            storage.Dispose ();

            foreach(var note in sample_notes) {
                // the stored notes should only contain hex chars
                using (var db = connFactory.OpenDbConnection ()) {
                    var db_note = db.First<DBNote> (n => n.Guid == note.Guid);
                    // this will fail if any non-hex chars are in
                    Assert.IsFalse (db_note.IsEncypted);
                }
            }
        }