public async void TestRunBackgroundWorker() { var platformServicesFake = A.Fake <IPlatformServices>(); Device.PlatformServices = platformServicesFake; DatabaseMigrator.Migrate(_connection, _migrationSkriptFolderPath); MessagingCenter.Subscribe <StartBackgroundWorkingServiceMessage>(this, MessageHelper.START_BACKGROUND_WORKING_SERVICE_MESSAGE, message => { var msg = new DiagnosticMessage("Start Background Working Service"); output.WriteLine("{0}", msg.Message); }); MessagingCenter.Subscribe <StopBackgroundWorkingServiceMessage>(this, MessageHelper.STOP_BACKGROUND_WORKING_SERVICE_MESSAGE, message => { var msg = new DiagnosticMessage("Stop Background Working Service"); output.WriteLine("{0}", msg.Message); }); MessagingCenter.Subscribe <ElementFinishedMessage>(this, MessageHelper.ELEMENT_FINISHED_MESSAGE, message => { var msg = new DiagnosticMessage("Element processed"); output.WriteLine("{0}", msg.Message); }); var deleteAll = BackgroundQueueService.EmptyQueue(_connection).Result; Assert.True(deleteAll); var testSpotGuid = Guid.NewGuid(); var testLat = 48.45; var testLng = 13.9167; var result = BackgroundQueueService.PushWheaterRequestToBackgroundQueue(_connection, testSpotGuid, testLat, testLng).Result; Assert.True(result != Guid.Empty); await BackgroundWorkerService.RunBackgroundWorkerService(_connection, new CancellationToken(false)); int cnt = BackgroundQueueService.GetQueueElementCount(_connection).Result; Assert.Equal(0, cnt); }
private void InitDatabaseIfNeeded(IApplicationBuilder app) { app.EnsureDatabase(connStr => { if (!connStr.IsForTemporaryDatabase()) { return; } _startupLogger.LogCritical("正在创建和更新数据库结构..."); var loggingConfig = _appConfiguration.GetSection(WebHostConfiguration.ConfigKeyLogging); DatabaseMigrator.Migrate(connStr, migrationLogging => FileLoggingExtensions.AddSeriFileLogger(migrationLogging, loggingConfig /* enable full logging for migrations */)); _startupLogger.LogCritical("数据库结构创建并更新完成"); }, _startupLogger); }
public SettingsTest() { DatabaseMigrator.Migrate(_connection, _migrationSkriptFolderPath); }
public SimpleServiceTest() { DatabaseMigrator.Migrate(_connection, _migrationSkriptFolderPath); }
public TestGetSpot() { DatabaseMigrator.Migrate(_connection, _migrationSkriptFolderPath); }
public TestSaveFishingArea() { DatabaseMigrator.Migrate(_connection, _migrationSkriptFolderPath); }
public void TestUpdateScriptCompleted() { Assert.True(DatabaseMigrator.Migrate(_connection, _migrationSkriptFolderPath)); }