Example #1
0
        public void ExchangingFilePathSimple_FilePathSuccessfullyExchanged()
        {
            var sentFilePath = new FilePath();
            sentFilePath.Iterations = 1;
            sentFilePath.Path = @"C\Windows\file path";

            serializer.Serialize(clientStream, sentFilePath);
            var receivedFilePath = (FilePath)serializer.Deserialize(serverStream);

            Assert.AreEqual(sentFilePath.Iterations, receivedFilePath.Iterations);
            Assert.AreEqual(sentFilePath.Path, receivedFilePath.Path);
        }
Example #2
0
        public void ExchangingFilePathWithTypeIndicator_FilePathSuccessfullyExchanged()
        {
            var sentFilePathType = PacketType.FilePath;
            serializer.Serialize(clientStream, sentFilePathType);

            var sentFilePath = new FilePath();
            sentFilePath.Iterations = 1;
            sentFilePath.Path = @"C\Windows\file path";
            serializer.Serialize(clientStream, sentFilePath);

            var receivedFilePathType = (PacketType)serializer.Deserialize(serverStream);
            var receivedFilePath = (FilePath)serializer.Deserialize(serverStream);

            Assert.AreEqual(sentFilePathType, receivedFilePathType);
            Assert.AreEqual(sentFilePath.Iterations, receivedFilePath.Iterations);
            Assert.AreEqual(sentFilePath.Path, receivedFilePath.Path);
        }
Example #3
0
        internal static void SendFilePath(int iterations, string path)
        {
            try
            {
                var type = PacketType.FilePath;
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(Server.ServerStream, type);

                var filePath = new FilePath();
                filePath.Iterations = iterations;
                filePath.Path = path;
                formatter.Serialize(Server.ServerStream, filePath);
            }
            catch (Exception)
            {
            }
        }