Пример #1
0
        public async Task GetRemoteFileTest()
        {
            var serverCommunicator = new Communicator();
            var server             = new RemoteFileServer(serverCommunicator, PathToStorage, PathToServerTempStorage); // Path.GetTempPath());

            server.StartServer();

            var clientCommunicator = new Communicator();
            var client             = new RemoteStorageLocation(clientCommunicator, "192.168.1.6", PathToClientTempStorage);
            await client.Connect();

            var file = new BackupFile(FileToStorePath);
            var hash = Hasher.GetFileHash(file);
            await client.StoreFile(file, hash);

            var filePath = await client.GetFile(hash);
        }
Пример #2
0
        public async Task StoreRemoteFileTest()
        {
            var serverCommunicator = new Communicator();
            var server             = new RemoteFileServer(serverCommunicator, PathToStorage, PathToServerTempStorage); // Path.GetTempPath());

            server.StartServer();

            var clientCommunicator = new Communicator(13001, new NetworkClient("Test", new TcpClient()), new NetworkListener());
            var client             = new RemoteStorageLocation(clientCommunicator, "192.168.1.6", PathToClientTempStorage);
            await client.Connect();


            var file = new BackupFile(FileToStorePath);
            var hash = Hasher.GetFileHash(file);

            var storeReslts = await client.StoreFile(file, hash);

            Assert.IsTrue(storeReslts);
        }