public void DispatchingActionsUpdatesTheStore() { var history = new List <string>(); var observable = _app.Store .Select(state => state.Value); using (observable.Subscribe(value => history.Add(value))) { Assert.That(history, Is.EqualTo(new[] { "initial" })); _app.Dispatch(new UpdateValueAction("do the dishes")); Assert.That(history, Is.EqualTo(new[] { "initial", "do the dishes" })); } }
public void Listen() { Console.WriteLine("Type your todos and press enter. Enter 'q' to exit."); while (true) { Console.Write("> "); var command = Console.ReadLine(); switch (command) { case "": break; case "q": return; default: _app.Dispatch(new AddTodo(command)); break; } } }