public void should_execute_command() { bool commandExecuted = false; var command = new ActionCommand(() => commandExecuted = true); var listBox = new ListBox(); DoubleClickCommandBehavior.SetCommand(listBox, command); var e = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left); e.RoutedEvent = Control.MouseDoubleClickEvent; listBox.RaiseEvent(e); commandExecuted.ShouldBe(true); }
public void should_execute_command() { bool executed = false; var command = new ActionCommand(() => executed = true); var listBox = new ListBox(); var behavior = new DoubleClickBlendBehavior(); behavior.Command = command; behavior.Attach(listBox); var e = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left); e.RoutedEvent = Control.MouseDoubleClickEvent; listBox.RaiseEvent(e); executed.ShouldBe(true); }