Пример #1
0
        public void ImageEditor_LoadFromStream_MetafileStream_ThrowsArgumentException()
        {
            var editor = new SubImageEditor();

            using (Stream stream = File.OpenRead("Resources/telescope_01.wmf"))
            {
                Assert.Throws <ArgumentException>(null, () => editor.LoadFromStream(stream));
            }
        }
Пример #2
0
        public void ImageEditor_LoadFromStream_BitmapStream_ReturnsExpected()
        {
            var editor = new SubImageEditor();

            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);
                }
        }
Пример #3
0
        public void ImageEditor_LoadFromStream_NullStream_ThrowsArgumentNullException()
        {
            var editor = new SubImageEditor();

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