public void TestDatabaseIsInitialized()
        {
            var mockStorageAdapter = Mock.Of <IStorageAdapter>();
            var storage            = new Microsoft.AppCenter.Storage.Storage(mockStorageAdapter);

            storage.WaitOperationsAsync(TimeSpan.FromSeconds(10)).Wait();

            // Verify database is initialized as a result of calling constructor.
            Mock.Get(mockStorageAdapter).Verify(adapter => adapter.CreateTableAsync <Microsoft.AppCenter.Storage.Storage.LogEntry>());
            Mock.Get(mockStorageAdapter).Verify(adapter => adapter.InitializeStorageAsync());
        }
Esempio n. 2
0
        public void TestDatabaseIsInitialized()
        {
            var mockStorageAdapter = Mock.Of<IStorageAdapter>();
            using (var storage = new Microsoft.AppCenter.Storage.Storage(mockStorageAdapter, _databasePath))
            {
                storage.WaitOperationsAsync(TimeSpan.FromSeconds(10)).Wait();

                // Verify database is initialized as a result of calling constructor.
                Mock.Get(mockStorageAdapter).Verify(adapter => adapter.CreateTable(TableName, It.IsAny<string[]>(), It.IsAny<string[]>()));
                Mock.Get(mockStorageAdapter).Verify(adapter => adapter.Initialize(It.IsAny<string>()));
            }
        }