public TrackImageData(byte[] fullSizeData, byte[] resized64X64Data, byte[] resized24X24Data) { if (fullSizeData == null) throw new ArgumentNullException("fullSizeData"); if (resized64X64Data == null) throw new ArgumentNullException("resized64X64Data"); if (resized24X24Data == null) throw new ArgumentNullException("resized24X24Data"); FullSize = new ImageData(fullSizeData); Resized64X64 = new ImageData(resized64X64Data); Resized24X24 = new ImageData(resized24X24Data); }
static void ShouldBeImageOf(ImageData buffer, int maxWidth, int maxHeight) { buffer.ShouldNotBeNull(); buffer.Data.ShouldNotBeEmpty(); using (var stream = new MemoryStream(buffer.Data)) using (var image = Image.FromStream(stream)) { image.Width.ShouldBeLessThanOrEqualTo(maxWidth); image.Height.ShouldBeLessThanOrEqualTo(maxHeight); } }