public void TestSegmentWithMultipleOccurrences()
        {
            var segmentData   = new JpegSegmentData();
            var segmentType   = JpegSegmentType.App3;
            var segmentBytes1 = new byte[] { 1, 2, 3 };
            var segmentBytes2 = new byte[] { 3, 2, 1 };

            segmentData.AddSegment(segmentType, segmentBytes1);
            segmentData.AddSegment(segmentType, segmentBytes2);
            Assert.Equal(2, segmentData.GetSegmentCount(segmentType));
            Assert.Equal(segmentBytes1, segmentData.GetSegment(segmentType));
            Assert.Equal(segmentBytes2, segmentData.GetSegment(segmentType, occurrence: 1));
        }
        public void TestRemoveSegmentOccurrence()
        {
            var segmentData   = new JpegSegmentData();
            var segmentType   = JpegSegmentType.App3;
            var segmentBytes1 = new byte[] { 1, 2, 3 };
            var segmentBytes2 = new byte[] { 3, 2, 1 };

            segmentData.AddSegment(segmentType, segmentBytes1);
            segmentData.AddSegment(segmentType, segmentBytes2);
            Assert.Equal(2, segmentData.GetSegmentCount(segmentType));
            Assert.Equal(segmentBytes1, segmentData.GetSegment(segmentType));
            segmentData.RemoveSegmentOccurrence(segmentType, 0);
            Assert.Equal(segmentBytes2, segmentData.GetSegment(segmentType));
        }
        public void TestAddingMultipleSegments()
        {
            var segmentData   = new JpegSegmentData();
            var segmentType1  = JpegSegmentType.App3;
            var segmentType2  = JpegSegmentType.App4;
            var segmentBytes1 = new byte[] { 1, 2, 3 };
            var segmentBytes2 = new byte[] { 3, 2, 1 };

            segmentData.AddSegment(segmentType1, segmentBytes1);
            segmentData.AddSegment(segmentType2, segmentBytes2);
            Assert.Equal(1, segmentData.GetSegmentCount(segmentType1));
            Assert.Equal(1, segmentData.GetSegmentCount(segmentType2));
            Assert.Equal(segmentBytes1, segmentData.GetSegment(segmentType1));
            Assert.Equal(segmentBytes2, segmentData.GetSegment(segmentType2));
        }
        public void TestRemoveSegment()
        {
            var segmentData   = new JpegSegmentData();
            var segmentType   = JpegSegmentType.App3;
            var segmentBytes1 = new byte[] { 1, 2, 3 };
            var segmentBytes2 = new byte[] { 3, 2, 1 };

            segmentData.AddSegment(segmentType, segmentBytes1);
            segmentData.AddSegment(segmentType, segmentBytes2);
            Assert.Equal(2, segmentData.GetSegmentCount(segmentType));
            Assert.True(segmentData.ContainsSegment(segmentType));
            Assert.Equal(segmentBytes1, segmentData.GetSegment(segmentType));
            segmentData.RemoveAllSegments(segmentType);
            Assert.True(!segmentData.ContainsSegment(segmentType));
            Assert.Equal(0, segmentData.GetSegmentCount(segmentType));
        }
        public void TestContainsSegment()
        {
            var segmentData  = new JpegSegmentData();
            var segmentType  = JpegSegmentType.App3;
            var segmentBytes = new byte[] { 1, 2, 3 };

            Assert.True(!segmentData.ContainsSegment(segmentType));
            segmentData.AddSegment(segmentType, segmentBytes);
            Assert.True(segmentData.ContainsSegment(segmentType));
        }
        public void TestAddAndGetSegment()
        {
            var segmentData  = new JpegSegmentData();
            var segmentType  = JpegSegmentType.App3;
            var segmentBytes = new byte[] { 1, 2, 3 };

            segmentData.AddSegment(segmentType, segmentBytes);
            Assert.Equal(1, segmentData.GetSegmentCount(segmentType));
            Assert.Equal(segmentBytes, segmentData.GetSegment(segmentType));
        }