public static void Init(TestContext tc)
        {
            CommandFile.SharedFolder   = "A:\\Cmmd";
            _cmmdTolocalDbFilePath     = Path.Combine(Properties.Resources.Local, $"{nameof(Add_SqliteDb_CmmdToSharedFolderToLocalDbVSDirectlyToLocalFolderVSToSharedFolderTest)}_local{NetCoreSqliteDB.SqliteDBContext.DBFileExtensionName}");
            _directlyTolocalDbFilePath = Path.Combine(Properties.Resources.Local, $"{nameof(Add_SqliteDb_CmmdToSharedFolderToLocalDbVSDirectlyToLocalFolderVSToSharedFolderTest)}_directlyToLocal{NetCoreSqliteDB.SqliteDBContext.DBFileExtensionName}");
            _sharedFolderDbFilePath    = Path.Combine(Properties.Resources.Shared, $"{nameof(Add_SqliteDb_CmmdToSharedFolderToLocalDbVSDirectlyToLocalFolderVSToSharedFolderTest)}_sharedFolder{NetCoreSqliteDB.SqliteDBContext.DBFileExtensionName}");

            NetCoreSqliteDB.SqliteDBContext.CopyTempateDBFile(_cmmdTolocalDbFilePath);
            NetCoreSqliteDB.SqliteDBContext.CopyTempateDBFile(_directlyTolocalDbFilePath);
            NetCoreSqliteDB.SqliteDBContext.CopyTempateDBFile(_sharedFolderDbFilePath);

            _cmmdLocalRepository       = new SqliteDBRepository(_cmmdTolocalDbFilePath);
            _directlyToLocalRepository = new SqliteDBRepository(_directlyTolocalDbFilePath);
            _sharedFolderRepository    = new SqliteDBRepository(_sharedFolderDbFilePath);

            _entitiy1000 = new Entity1[1000];
            for (int i = 0; i < 1000; i++)
            {
                _entitiy1000[i] = AddDataRowsHelper.CreateDataRow <Entity1>(0, i);
            }

            _cmmdReceiver = new CommandReceiver(new JsonSer(), _cmmdLocalRepository);
            _cmmdReceiver.Start();

            _cmmdSender = new CommandSender(new JsonSer());
        }
Exemple #2
0
        public static void Init(TestContext tc)
        {
            CommandFile.SharedFolder = "A:\\Cmmd";
            _localDbFilePath         = Path.Combine(Properties.Resources.Local, $"{nameof(Edit_SqliteDb_CmmdToSharedFolderToLocalDbVSToSharedFolderTest)}{SqliteDBContext.DBFileExtensionName}");
            _sharedFolderDbFilePath  = Path.Combine(Properties.Resources.Shared, $"{nameof(Edit_SqliteDb_CmmdToSharedFolderToLocalDbVSToSharedFolderTest)}{SqliteDBContext.DBFileExtensionName}");

            NetCoreSqliteDB.SqliteDBContext.CopyTempateDBFile(_localDbFilePath);


            _localRepository        = new SqliteDBRepository(_localDbFilePath);
            _sharedFolderRepository = new SqliteDBRepository(_sharedFolderDbFilePath);

            _entitiy1000 = new Entity1[1000];
            for (int i = 0; i < 1000; i++)
            {
                _entitiy1000[i] = AddDataRowsHelper.CreateDataRow <Entity1>(0, i);
            }

            var localDbContext = new NetCoreSqliteDB.SqliteDBContext(_localDbFilePath);

            localDbContext.Table1.AddRange(_entitiy1000);
            localDbContext.SaveChanges();

            File.Copy(_localDbFilePath, _sharedFolderDbFilePath, true);

            foreach (var e in _entitiy1000)
            {
                e.P3 = "Edited";
                e.BasedOnUpdatedDateTime = e.UpdatedDateTime;
                e.UpdatedDateTime        = DateTime.Now;
            }

            _cmmdReceiver = new CommandReceiver(new JsonSer(), _localRepository);
            _cmmdReceiver.Start();

            _cmmdSender = new CommandSender(new JsonSer());
        }