/// <summary> /// view model base is told which model objects to watch for changes /// when change happens, view for this view model will update all property bindings /// </summary> public MainViewModel(Main main, UpdateModelCommand updateModelCommand, ModelChanger modelChanger) : base(modelChanger, main) { this.main = main; this.updateModelCommand = updateModelCommand; this.UpdateCounterDetails(); }
public void MainTest() { const string TestWord = "wactontest"; // using moq to help testing without writing dummy classes var mockWordProvider = new Mock<IWordRepository>(); mockWordProvider.Setup(provider => provider.GetRandomWord()).Returns(TestWord); var wordProvider = mockWordProvider.Object; var main = new Main(wordProvider); main.Update(); Assert.That(main.Word, Is.EqualTo(TestWord)); }
/// <summary> /// model command is explicitly told which objects will be changed /// when the model command is executed /// --- /// ninject singleton bindings will ensure these objects are the same /// as the objects used elsewhere in the domain model and view models /// </summary> public UpdateModelCommand(ModelChanger modelChanger, Main main) : base(modelChanger, main) { this.main = main; }