Exemple #1
0
        public void MetafileEditor_GetExtensions_InvokeDefault_ReturnsExpected()
        {
            var editor = new SubMetafileEditor();

            string[] extensions = editor.GetExtensions();
            Assert.Equal(new string[] { "emf", "wmf" }, extensions);
            Assert.NotSame(extensions, editor.GetExtensions());
        }
Exemple #2
0
        public void MetafileEditor_LoadFromStream_MetafileStream_ReturnsExpected()
        {
            var editor = new SubMetafileEditor();

            using (Stream stream = File.OpenRead("Resources/telescope_01.wmf"))
            {
                Metafile result = Assert.IsType <Metafile>(editor.LoadFromStream(stream));
                Assert.Equal(new Size(3096, 4127), result.Size);
            }
        }
Exemple #3
0
        public void MetafileEditor_LoadFromStream_BitmapStream_ThrowsExternalException()
        {
            var editor = new SubMetafileEditor();

            using (MemoryStream stream = new MemoryStream())
                using (var image = new Bitmap(10, 10))
                {
                    image.Save(stream, ImageFormat.Bmp);
                    stream.Position = 0;
                    Assert.Throws <ExternalException>(() => editor.LoadFromStream(stream));
                }
        }
Exemple #4
0
        public void MetafileEditor_LoadFromStream_NullStream_ThrowsArgumentNullException()
        {
            var editor = new SubMetafileEditor();

            Assert.Throws <ArgumentNullException>("stream", () => editor.LoadFromStream(null));
        }
Exemple #5
0
        public void MetafileEditor_GetFileDialogDescription_Invoke_ReturnsExpected()
        {
            var editor = new SubMetafileEditor();

            Assert.Equal("Metafiles", editor.GetFileDialogDescription());
        }