예제 #1
0
        /// <summary>
        /// Store the hash map
        /// </summary>
        /// <param name="stream">Stream from whcih file comes</param>
        /// <param name="Size">Size of the file</param>
        public void StoreHashMapFile(Stream stream, int Size)
        {
            string mapFile = file;

            // Delete the existing file, any way we are going to store the new one
            if (File.Exists(mapFile))
            {
                Delete();
            }

            FileStream HashStream = File.OpenWrite(mapFile);

            try
            {
                StreamStream ss = new StreamStream(HashStream);
                ss.Write(stream, Size);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                HashStream.Close();
            }
        }
예제 #2
0
 public void WriteSingleResponse()
 {
     var stream = new MemoryStream ();
     var streamStream = new StreamStream (new TestStream (null, stream));
     streamStream.Write (expectedMessage);
     byte[] bytes = stream.ToArray ();
     Assert.IsTrue (messageBytes.SequenceEqual (bytes));
 }
예제 #3
0
        public void WriteSingleResponse()
        {
            var stream       = new MemoryStream();
            var streamStream = new StreamStream(new TestStream(null, stream));

            Assert.AreEqual(0, streamStream.BytesWritten);
            Assert.AreEqual(0, streamStream.BytesRead);
            streamStream.Write(expectedUpdate);
            Assert.AreEqual(updateBytes.Length, streamStream.BytesWritten);
            Assert.AreEqual(0, streamStream.BytesRead);
            Assert.AreEqual(updateBytes.ToHexString(), stream.ToArray().ToHexString());
        }
예제 #4
0
        public void WriteSingleResponse()
        {
            var stream       = new MemoryStream();
            var streamStream = new StreamStream(new TestStream(null, stream));

            Assert.AreEqual(0, streamStream.BytesWritten);
            Assert.AreEqual(0, streamStream.BytesRead);
            streamStream.Write(expectedMessage);
            byte[] bytes = stream.ToArray();
            Assert.AreEqual(bytes.Length, streamStream.BytesWritten);
            Assert.AreEqual(0, streamStream.BytesRead);
            Assert.IsTrue(messageBytes.SequenceEqual(bytes));
        }