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 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)); }