Example #1
0
 /// <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();
 }
Example #2
0
        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));
        }
Example #3
0
 /// <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;
 }