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

            string[] extensions = editor.GetExtensions();
            Assert.Equal(new string[] { "bmp", "gif", "jpg", "jpeg", "png", "ico" }, extensions);
            Assert.NotSame(extensions, editor.GetExtensions());
        }
Example #2
0
        public void BitmapEditor_BitmapExtensions_Get_ReturnsExpected()
        {
            var           editor     = new SubBitmapEditor();
            List <string> extensions = SubBitmapEditor.BitmapExtensions;

            Assert.Equal(new string[] { "bmp", "gif", "jpg", "jpeg", "png", "ico" }, extensions);
            Assert.Same(extensions, SubBitmapEditor.BitmapExtensions);
        }
Example #3
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 #4
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 #5
0
        public void BitmapEditor_GetFileDialogDescription_Invoke_ReturnsExpected()
        {
            var editor = new SubBitmapEditor();

            Assert.Equal("Bitmap files", editor.GetFileDialogDescription());
        }
Example #6
0
        public void BitmapEditor_LoadFromStream_NullStream_ThrowsArgumentNullException()
        {
            var editor = new SubBitmapEditor();

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