Exemple #1
0
        private static void AddFirst5000DataRowsToDb()
        {
            var dbFile = _localDbFiles[0];

            if (!File.Exists(dbFile))
            {
                SqliteDBContext.CopyTempateDBFile(dbFile);
                using var dbContext = new SqliteDBContext(dbFile);
                AddDataRowsHelper.Add1BatchDataRows(dbContext.Table1, 0);
                dbContext.SaveChanges();
                dbContext.Database.CloseConnection();
            }
            var sharedDbFile = _sharedFolderDbFilePaths[0];

            if (!File.Exists(sharedDbFile))
            {
                File.Copy(dbFile, sharedDbFile);
            }
        }
Exemple #2
0
        public static void Init(TestContext _)
        {
            _localDbFilePaths        = new string[10];
            _sharedFolderDbFilePaths = new string[10];

            for (int i = 0; i < _localDbFilePaths.Length; i++)
            {
                _localDbFilePaths[i]        = Path.Combine(Properties.Resources.Local, $"{nameof(Add_SqliteDB_BasedOnDifferentDataRowCount_LocalVSSharedFolder_Tests)}{i}{SqliteDBContext.DBFileExtensionName}");
                _sharedFolderDbFilePaths[i] = Path.Combine(Properties.Resources.Shared, $"{nameof(Add_SqliteDB_BasedOnDifferentDataRowCount_LocalVSSharedFolder_Tests)}{i}{SqliteDBContext.DBFileExtensionName}");
            }

            for (int i = 0; i < _localDbFilePaths.Length; i++)
            {
                SqliteDBContext.CopyTempateDBFile(_localDbFilePaths[i]);
                using var localDbContext = new SqliteDBContext(_localDbFilePaths[i]);
                for (int j = 0; j < i + 1; j++)
                {
                    AddDataRowsHelper.Add1BatchDataRows <Entity1>(localDbContext.Table1, j);
                }
                localDbContext.SaveChanges();
                File.Copy(_localDbFilePaths[i], _sharedFolderDbFilePaths[i], true);
            }
        }