Beispiel #1
0
        public void SetUp()
        {
            _contextMock = new Mock<IDBContext>();
            _externalSourceMock = new Mock<IExternalDataSource>();

            _datasourcer = new DataSourcer(_contextMock.Object, _externalSourceMock.Object, true);
        }
Beispiel #2
0
        private async void Application_Startup(object sender, StartupEventArgs e)
        {
            //set up sqlite
            SQLitePCL.Batteries.Init();

            //Load settings
            var settings = SettingsUtils.LoadSettings();

            //initialize logging
            InitializeLogging(settings);

            //Log unhandled exceptions
            AppDomain.CurrentDomain.UnhandledException += AppDomain_CurrentDomain_UnhandledException;

            //db
            var contextFactory = new DbContextFactory(() => new QpasDbContext());

            InitializeDb(contextFactory);

            //check for empty account fields and load preferences
            using (var dbContext = contextFactory.Get())
            {
                if (dbContext.EquitySummaries.Any(x => x.AccountID == null))
                {
                    App.Splash.LoadComplete();
                    var accountMigrationWindow = new AccountMigrationWindow();
                    accountMigrationWindow.ShowDialog();
                }
            }

            var data = await DataLoader.LoadData(contextFactory);

            var qdmsSource = new ExternalDataSources.QDMS(settings, data.DatasourcePreferences.ToList());
            var ds         = new DataSourcer(contextFactory, qdmsSource, data, settings.AllowExternalDataSource);

            var window = new MainWindow(data, settings, contextFactory, ds);
        }