Exemplo n.º 1
0
        private string GetConnectionString()
        {
            var path = DbLocator.GetDatabasePath();
            var cs   = $@"Filename={path};";

            return(cs);
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            mMessageBoxer   = A.Fake <IMessageBoxer>();
            mOpenFileDialog = A.Fake <IMyOpenFileDialog>();
            mFileSystem     = A.Fake <IFileSystem>();
            mFile           = A.Fake <IFile>();
            mySettings      = A.Fake <IMySettings>();

            A.CallTo(() => mySettings.GetCombinedSetting("DbFileFullPath")).Returns(@"folder\file.dbx");
            A.CallTo(() => mFileSystem.GetFile(@"folder\file.dbx")).Returns(mFile);

            mUnderTest = new DbLocator(mMessageBoxer, mOpenFileDialog, mFileSystem, mySettings);
        }
Exemplo n.º 3
0
        protected IDbConnection NewConnection()
        {
            var cs = GetConnectionString();

            Log.Trace($"Creating new connection at '{cs}'");

            if (!DbLocator.CheckDbExist() || !HasTable())
            {
                Log.Info($"Database does not exists. Creation using this connection string '{cs}'");
                CreateDatabase();
            }

            return(new SqliteConnection(cs));
        }