Example #1
0
        public void BitmapEditor_LoadFromStream_MetafileStream_ReturnsExpected()
        {
            var editor = new SubBitmapEditor();

            using (Stream stream = File.OpenRead("Resources/telescope_01.wmf"))
            {
                Bitmap result = Assert.IsType <Bitmap>(editor.LoadFromStream(stream));
                Assert.Equal(new Size(490, 654), result.Size);
            }
        }
Example #2
0
        public void BitmapEditor_LoadFromStream_BitmapStream_ReturnsExpected()
        {
            var editor = new SubBitmapEditor();

            using (MemoryStream stream = new MemoryStream())
                using (var image = new Bitmap(10, 10))
                {
                    image.Save(stream, ImageFormat.Bmp);
                    stream.Position = 0;
                    Bitmap result = Assert.IsType <Bitmap>(editor.LoadFromStream(stream));
                    Assert.Equal(new Size(10, 10), result.Size);
                }
        }
Example #3
0
        public void BitmapEditor_LoadFromStream_NullStream_ThrowsArgumentNullException()
        {
            var editor = new SubBitmapEditor();

            Assert.Throws <ArgumentNullException>("stream", () => editor.LoadFromStream(null));
        }