示例#1
0
        public void ActionTest()
        {
            var databaseFiles = new List <string>
            {
                Remove_it_on_server_side,
                Remove_it_on_client_side,
                Update_it_on_client_side,
            };

            var deviceFiles = new List <FileInfoModel>
            {
                new FileInfoModel(Remove_it_on_client_side, 1),
                new FileInfoModel(Add_it_on_server_side, 1),
                new FileInfoModel(Update_it_on_client_side, 1),
            };

            var serverFiles = new List <FileInfoModel>
            {
                new FileInfoModel(Remove_it_on_server_side, 1),
                new FileInfoModel(Add_it_on_client_side, 1),
                new FileInfoModel(Update_it_on_client_side, 2),
            };

            void CheckAssert(IList <FileInfoModel> result, string element)
            {
                Assert.AreEqual(result.Count, 1);
                Assert.AreEqual(result.FirstOrDefault()?.Path, element);
            }

            var serverRemoveFiles       = new ServerRemoveFiles();
            var resultServerRemoveFiles = serverRemoveFiles.Get(databaseFiles, deviceFiles, serverFiles);

            CheckAssert(resultServerRemoveFiles, Remove_it_on_server_side);

            var clientRemoveFiles       = new ClientRemoveFiles();
            var resultClientRemoveFiles = clientRemoveFiles.Get(databaseFiles, deviceFiles, serverFiles);

            CheckAssert(resultClientRemoveFiles, Remove_it_on_client_side);

            var serverAddFiles       = new ServerAddFiles();
            var resultServerAddFiles = serverAddFiles.Get(databaseFiles, deviceFiles, serverFiles);

            CheckAssert(resultServerAddFiles, Add_it_on_server_side);

            var clientAddFiles       = new ClientAddFiles();
            var resultClientAddFiles = clientAddFiles.Get(databaseFiles, deviceFiles, serverFiles);

            CheckAssert(resultClientAddFiles, Add_it_on_client_side);

            var clientUpdateFiles       = new ClientUpdateFiles();
            var resultClientUpdateFiles = clientUpdateFiles.Get(databaseFiles, deviceFiles, serverFiles);

            CheckAssert(resultClientUpdateFiles, Update_it_on_client_side);
        }
示例#2
0
        public CoreModule(IFileManager fileManager,
                          ISyncTableDataBase syncTableDataBase,
                          IConnectionStateManager connectionStateManager,
                          IUserTableDataBase userTableDataBase) : base("core", new Version(0, 1))
        {
            _logger                 = LogManager.GetCurrentClassLogger();
            _fileManager            = fileManager;
            _syncTableDataBase      = syncTableDataBase;
            _connectionStateManager = connectionStateManager;
            _userTableDataBase      = userTableDataBase;

            _serverRemoveFiles      = new ServerRemoveFiles();
            _clientRemoveFiles      = new ClientRemoveFiles();
            _serverAddFiles         = new ServerAddFiles();
            _clientAddFiles         = new ClientAddFiles();
            _clientUpdateFiles      = new ClientUpdateFiles();
            _clientServerExistFiles = new ClientServerExistFiles();
        }