public void CommandOnComplete_Test() { //Given bool completed = false; ReactiveCommand<string> command = new ReactiveCommand<string>(t => { }, _ => false, () => { completed = true; }); //When command.OnNext(Any.Create<string>()); command.OnCompleted(); //Then Assert.That(completed, Is.True); }
public void FullCommand_Test() { //Given const string message = "Reactive"; string result = null; bool completed = false; Exception exception = null; string expected = Any.Create<string>(); var command = new ReactiveCommand<string>(t => result = t, _ => true,ex => exception = ex,() => completed = true ); //When bool canExecute = command.CanExecute(null); command.Execute(expected); command.OnError(new Exception(message)); command.OnCompleted(); //Then Assert.True(canExecute); Assert.AreEqual(result, expected); Assert.That(exception.Message, Is.EqualTo(message)); Assert.True(completed); }