public void DataCopiedTriggersEvent() { SystemUnderTest.Connect(); object eventSender = null; PackageEventArgument eventArgument = null; SystemUnderTest.PackageAdded += (sender, e) => { eventSender = sender; eventArgument = e; }; var fakeClipboardHookService = Container.Resolve <IClipboardCopyInterceptor>(); fakeClipboardHookService.DataCopied += Raise.Event <EventHandler <DataCopiedEventArgument> >( fakeClipboardHookService, new DataCopiedEventArgument()); var addedPackage = SystemUnderTest.ClipboardElements.Last(); Assert.IsNotNull(addedPackage); Assert.AreSame(SystemUnderTest, eventSender); Assert.AreSame(addedPackage, eventArgument.Package); }
void MediatorPackageAdded(object sender, PackageEventArgument e) { lock (Elements) { Elements.Insert(0, e.Package); SelectedElement = e.Package; while (Elements.Count > settingsViewModel.MaximumAmountOfItemsInClipboard) { Elements.RemoveAt(Elements.Count - 1); } } }
public void ConnectTriggersControlAddedEvent() { object eventSender = null; PackageEventArgument eventArgument = null; SystemUnderTest.PackageAdded += (sender, e) => { eventSender = sender; eventArgument = e; }; SystemUnderTest.Connect(); var addedPackage = SystemUnderTest.ClipboardElements.Single(); Assert.IsNotNull(addedPackage); Assert.AreSame(SystemUnderTest, eventSender); Assert.AreSame(addedPackage, eventArgument.Package); }
void MediatorPackageAdded(object sender, PackageEventArgument e) { AddElement(e.Package); }