public void PasteFromClipboard_WithEmptyClipboard() { string result = null; System.Threading.Thread t = new System.Threading.Thread(() => { var pManager = new PersistenceManager(); var tree = pManager.NewTree(); var editor = new NoteEditor(); var form = CreateForm(); form.Controls.Add(editor); var sut = new ClipboardImagePaster(editor, pManager); form.Shown += (sender, args) => { Clipboard.Clear(); ClipboardImagePaster.PasteFromClipboard(editor, tree); result = editor.HTML; form.Close(); }; form.ShowDialog(); }); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); Assert.IsNull(result); }
public void PasteFromClipboard() { string result = null; System.Threading.Thread t = new System.Threading.Thread(() => { var pManager = new PersistenceManager(); var tree = pManager.NewTree(); var editor = new NoteEditor(); var form = CreateForm(); form.Controls.Add(editor); var sut = new ClipboardImagePaster(editor, pManager); form.Shown += (sender, args) => { Clipboard.SetImage(Bitmap.FromFile(@"Resources\MapCtrl1.png")); ClipboardImagePaster.PasteFromClipboard(editor, tree); result = editor.HTML; form.Close(); }; form.ShowDialog(); }); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); Assert.IsTrue(result.ToLower().Contains("img")); }