public void WhenAModuleIsSelectectedItsIsSelectedPropertyMustGetSet()
        {
            var builder            = new MainWindowViewModelBuilder(2);
            MainWindowViewModel vm = builder.Build();

            // change selection to the second module
            vm.SelectModuleCommand.Execute(vm.Modules[1]);

            Assert.IsTrue(vm.Modules[1].IsSelected);
        }
        public void WhenAModuleIsDeselectectedItsIsSelectedPropertyMustGetUnset()
        {
            var builder            = new MainWindowViewModelBuilder(2);
            MainWindowViewModel vm = builder.Build();

            // change selection to the second module
            vm.SelectModuleCommand.Execute(vm.Modules[1]);

            // check the first module gets unset
            Assert.IsFalse(vm.Modules[0].IsSelected);
        }
        public void WhenAModuleIsSelectedItsLoadMethodMustBeCalled()
        {
            var builder            = new MainWindowViewModelBuilder(2);
            MainWindowViewModel vm = builder.Build();

            // change selection to the second module
            vm.SelectModuleCommand.Execute(vm.Modules[1]);

            // check load was called on it
            builder.MockModules[1].Verify(x => x.Load());
        }
        public void WhenSelectedModuleChangesPropertyChangedEventFires()
        {
            var builder            = new MainWindowViewModelBuilder(2);
            MainWindowViewModel vm = builder.Build();

            List <string> propertiesChanged = new List <string>();

            vm.PropertyChanged += (sender, args) => propertiesChanged.Add(args.PropertyName);

            vm.SelectModuleCommand.Execute(vm.Modules[1]);

            Assert.AreEqual(1, propertiesChanged.Count);
            Assert.IsTrue(propertiesChanged.Contains("UserInterface"));
        }