public void RaisesCanExecuteChangedWithNextCanExecuteImplementation( Subject <Func <object, bool> > source, object parameter) { var sut = new ReactiveCommand <Unit>( source, _ => Task.FromResult(Unit.Default)); sut.MonitorEvents(); source.OnNext(p => p == parameter); sut.ShouldRaise(nameof(sut.CanExecuteChanged)) .WithSender(sut).WithArgs <EventArgs>(a => a == EventArgs.Empty); sut.CanExecute(parameter).Should().BeTrue(); sut.CanExecute(new object()).Should().BeFalse(); }
public void RaisesCanExecuteChangedWithNextCanExecuteImplementation( Subject<Func<object, bool>> source, object parameter) { var sut = new ReactiveCommand<Unit>( source, _ => Task.FromResult(Unit.Default)); sut.MonitorEvents(); source.OnNext(p => p == parameter); sut.ShouldRaise(nameof(sut.CanExecuteChanged)) .WithSender(sut).WithArgs<EventArgs>(a => a == EventArgs.Empty); sut.CanExecute(parameter).Should().BeTrue(); sut.CanExecute(new object()).Should().BeFalse(); }