public void FailToGetALog() { // Prepare data. StorageAdapter adapter = new StorageAdapter(); adapter.Initialize(_databasePath); var tables = new[] { ColumnIdName, ColumnChannelName, ColumnLogName }; var types = new[] { "INTEGER PRIMARY KEY AUTOINCREMENT", "TEXT NOT NULL", "TEXT NOT NULL" }; adapter.CreateTable(TableName, tables, types); adapter.Insert(TableName, tables, new List<object[]> { new object[] { 100, StorageTestChannelName, "good luck deserializing me!" } }); var storage = new Microsoft.AppCenter.Storage.Storage(adapter, _databasePath); var logs = new List<Log>(); var batchId = storage.GetLogsAsync(StorageTestChannelName, 4, logs).RunNotAsync(); var count = storage.CountLogsAsync(StorageTestChannelName).RunNotAsync(); Assert.IsNull(batchId); Assert.AreEqual(0, logs.Count); Assert.AreEqual(0, count); }
public void FailOnOpenDatabaseWithWrongName() { var exception = Assert.ThrowsException <StorageException>(() => _adapter.Initialize("test://test.txt")); Assert.IsTrue(exception.Message.Contains("Failed to open database connection")); }