Пример #1
0
 public void InitializeNewDatabase()
 {
     using (var db = new Database(new ConfigManager()))
     {
         if (Directory.Exists(db.GetDatabaseDirectory()))
         {
             Directory.Delete(db.GetDatabaseDirectory(), true);
         }
         db.InitializeDatabase();
         Assert.That(File.Exists(db.DatabaseFullPath));
         var log = new LogEntity(DateTime.Now, TimeSpan.FromMilliseconds(300), false, new byte[] { 4, 4, 4 });
         db.InsertLogs(new LogEntity[] { log });
     }
 }
Пример #2
0
 public void GetDatabaseDefaultDirectory()
 {
     var expected = string.Empty;
     var baseD = AppDomain.CurrentDomain.BaseDirectory;
     if (baseD.IndexOf("bin\\Release", StringComparison.InvariantCultureIgnoreCase) >= 0 ||
         baseD.IndexOf("bin\\Debug", StringComparison.InvariantCultureIgnoreCase) >= 0)
     {
         expected = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "DB", "current"));
     }
     else
     {
         expected = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DB", "current"));
     }
     using (var db = new Database(new ConfigManager()))
     {
         var filePath = db.GetDatabaseDirectory();
         Assert.That(filePath, Is.EqualTo(expected));
         //Assert.AreEqual(filePath, expected);
     }
 }