public void ReceiveTextFileTest()
        {
            int linefeedChars = 1;    // Input is *nix style so only 1 linefeed char

            // Create a CvsStream based on a MemoryStream for ReceiveTextFile to receive the file from
            MemoryStream     memoryStream     = new MemoryStream();
            GZipOutputStream gzipOutputStream = new GZipOutputStream(memoryStream);
            CvsStream        cvsStream        = new CvsStream(gzipOutputStream);

            UncompressedFileHandlerTest.CreateTextStream(cvsStream);
            gzipOutputStream.Finish();    // This is essential to finish off the zipping
            cvsStream.BaseStream = memoryStream;
            cvsStream.Position   = 0;

            // Create a temporary file to receive the file to
            testFileName = Path.GetTempFileName();

            // Call the function under test
            CompressedFileHandler fileHandler = new CompressedFileHandler();

            fileHandler.ReceiveTextFile(cvsStream, testFileName,
                                        UncompressedFileHandlerTest.GetTextLen(UncompressedFileHandlerTest.TEXT_BLOCKS, linefeedChars));

            // check the received file
            UncompressedFileHandlerTest.CheckTextFile(testFileName);
        }
        public void SendTextFileTest()
        {
            // Create a temporary text file as the file to send
            testFileName = UncompressedFileHandlerTest.CreateTestTextFile();

            // Create a CvsStream based on a MemoryStream for SendTextFile to send the file to
            MemoryStream memoryStream = new MemoryStream();
            CvsStream    cvsStream    = new CvsStream(memoryStream);

            // Call the function under test
            CompressedFileHandler fileHandler = new CompressedFileHandler();

            fileHandler.SendTextFile(cvsStream, testFileName);

            // check what SendTextFile put in the stream
            cvsStream.BaseStream = new GZipInputStream(cvsStream.BaseStream);
            UncompressedFileHandlerTest.CheckTextStream(cvsStream, true);
        }
        public void ReceiveBinaryFileTest()
        {
            // Create a CvsStream based on a MemoryStream for ReceiveTextFile to receive the file from
            MemoryStream     memoryStream     = new MemoryStream();
            GZipOutputStream gzipOutputStream = new GZipOutputStream(memoryStream);
            CvsStream        cvsStream        = new CvsStream(gzipOutputStream);

            UncompressedFileHandlerTest.CreateBinaryStream(cvsStream);
            gzipOutputStream.Finish();    // This is essential to finish off the zipping
            cvsStream.BaseStream = memoryStream;
            cvsStream.Position   = 0;

            // Create a temporary file to receive the file to
            testFileName = Path.GetTempFileName();

            // Call the function under test
            CompressedFileHandler fileHandler = new CompressedFileHandler();

            fileHandler.ReceiveBinaryFile(cvsStream, testFileName,
                                          UncompressedFileHandlerTest.GetBinaryLen(UncompressedFileHandlerTest.BINARY_BLOCKS));

            // Now validate that the file we received is as expected
            UncompressedFileHandlerTest.CheckBinaryFile(testFileName);
        }