public void CommandBinderBindsToCustomControl() { var fixture = new CreatesWinformsCommandBinding(); var cmd = ReactiveCommand.Create <int>(_ => { }); var input = new CustomClickableControl { }; Assert.True(fixture.GetAffinityForObject(input.GetType(), true) > 0); Assert.True(fixture.GetAffinityForObject(input.GetType(), false) > 0); var commandExecuted = false; object ea = null; cmd.Subscribe(o => { ea = o; commandExecuted = true; }); using (fixture.BindCommandToObject(cmd, input, Observable.Return((object)5))) { input.PerformClick(); Assert.True(commandExecuted); Assert.NotNull(ea); } }
public WinformCommandBindView() { Command1 = new Button(); Command2 = new CustomClickableControl(); }