public void DetectFrameTest()
        {
            int bytesRead = _parser.Read(_stream);

            _parser.DetectFrame();
            Assert.IsTrue(_parser.HasFrame);
        }
        public void DetectWithNoBoundary()
        {
            List <byte> content = new List <byte>();

            byte[] buffer = new byte[100];

            Random random = new Random(1234);

            random.NextBytes(buffer);

            content.AddRange((byte[])_boundary);
            content.AddRange(JPEG_HEADER_BYTES);
            content.AddRange(buffer);
            content.AddRange(JPEG_HEADER_BYTES);
            content.AddRange(buffer);

            MemoryStream memoryStream = new MemoryStream(content.ToArray());

            MJPEGStreamParser parser = new MJPEGStreamParser(new Boundary(), JPEG_HEADER_BYTES);

            parser.Read(memoryStream);
            parser.DetectFrame();

            Assert.IsTrue(parser.HasFrame);
        }
        public void DetectWithNoFrameOrBoundaryTest()
        {
            byte[] buffer = new byte[1000];

            Random random = new Random(1234);

            random.NextBytes(buffer);

            MemoryStream memoryStream = new MemoryStream(buffer);

            MJPEGStreamParser parser = new MJPEGStreamParser(new Boundary(), JPEG_HEADER_BYTES);

            parser.Read(memoryStream);
            parser.DetectFrame();

            Assert.IsFalse(parser.HasFrame);
        }