public void RemoveFaseCommand_ExecutedWithFaseSelected_CallsRemoveSignalGroupFromController()
        {
            var model = new ControllerModel();
            var controllermodifiermock = FakesCreator.CreateControllerModifier();

            TLCGenControllerModifier.OverrideDefault(controllermodifiermock);
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "01"
            });
            FasenLijstTabViewModel vm = new FasenLijstTabViewModel();

            vm.Controller         = model;
            vm.SelectedFaseCyclus = vm.Fasen[0];

            vm.RemoveFaseCommand.Execute(null);

            controllermodifiermock.Received().RemoveSignalGroupFromController("01");
        }
        public void FasenTimersTabMultipleSelectionEdit_TGLChangedOnOnePhase_ChangesAllSelected()
        {
            var model = new ControllerModel();

            Messenger.OverrideDefault(new Messenger());
            TemplatesProvider.OverrideDefault(FakesCreator.CreateTemplatesProvider());
            model.Fasen.Add(new FaseCyclusModel {
                Naam = "01", TGL = 30
            });
            model.Fasen.Add(new FaseCyclusModel {
                Naam = "02", TGL = 30
            });
            model.Fasen.Add(new FaseCyclusModel {
                Naam = "03", TGL = 30
            });
            model.Fasen.Add(new FaseCyclusModel {
                Naam = "04", TGL = 30
            });
            model.Fasen.Add(new FaseCyclusModel {
                Naam = "05", TGL = 30
            });
            TLCGenModelManager.OverrideDefault(new TLCGenModelManager {
                Controller = model
            });
            TLCGenControllerDataProvider.OverrideDefault(FakesCreator.CreateControllerDataProvider(model));
            ControllerAccessProvider.OverrideDefault(FakesCreator.CreateControllerAccessProvider(model));
            var vm = new FasenLijstTimersTabViewModel {
                Controller = model
            };

            vm.OnSelected();
            vm.SelectedItems = new List <FaseCyclusViewModel> {
                vm.Fasen[1], vm.Fasen[2], vm.Fasen[3]
            };
            vm.Fasen[3].TGL = 50;

            Assert.AreEqual(30, vm.Fasen[0].TGL);
            Assert.AreEqual(50, vm.Fasen[1].TGL);
            Assert.AreEqual(50, vm.Fasen[2].TGL);
            Assert.AreEqual(50, vm.Fasen[3].TGL);
            Assert.AreEqual(30, vm.Fasen[4].TGL);
        }
Ejemplo n.º 3
0
        public void OnNameChanged_FaseRenamedHigherThanOthers_FaseNamedCorrectlyForDisplay()
        {
            var model = new ControllerModel();

            Messenger.OverrideDefault(new Messenger());
            SettingsProvider.OverrideDefault(FakesCreator.CreateSettingsProvider());
            DefaultsProvider.OverrideDefault(FakesCreator.CreateDefaultsProvider());
            TLCGenControllerDataProvider.OverrideDefault(FakesCreator.CreateControllerDataProvider(model));
            TLCGenModelManager.OverrideDefault(new TLCGenModelManager {
                Controller = model
            });
            model.Fasen.Add(new FaseCyclusModel {
                Naam = "01"
            });
            model.Fasen.Add(new FaseCyclusModel {
                Naam = "02"
            });
            model.Fasen.Add(new FaseCyclusModel {
                Naam = "03"
            });
            model.Fasen.Add(new FaseCyclusModel {
                Naam = "04"
            });
            model.Fasen.Add(new FaseCyclusModel {
                Naam = "05"
            });
            var vm = new FasenGroentijdenSetsTabViewModel {
                Controller = model
            };
            var vmfasen = new FasenLijstTabViewModel {
                Controller = model
            };

            vm.AddGroentijdenSetCommand.Execute(null);
            vmfasen.Fasen[2].Naam = "07";

            Assert.AreEqual(
                new string[5] {
                "01", "02", "04", "05", "07"
            },
                vm.FasenNames.ToArray());
        }
Ejemplo n.º 4
0
        public void AddGroentijdenSetCommand_ExecutedWhile5FasenInModel_AddsGroentijdenSetWith5FasenToModel()
        {
            var model = new ControllerModel();

            Messenger.OverrideDefault(FakesCreator.CreateMessenger());
            SettingsProvider.OverrideDefault(FakesCreator.CreateSettingsProvider());
            DefaultsProvider.OverrideDefault(FakesCreator.CreateDefaultsProvider());
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "01"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "02"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "03"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "04"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "05"
            });
            var vm = new FasenGroentijdenSetsTabViewModel();

            vm.Controller = model;

            vm.AddGroentijdenSetCommand.Execute(null);

            Assert.AreEqual(1, model.GroentijdenSets.Count);
            Assert.AreEqual(5, model.GroentijdenSets[0].Groentijden.Count);
            Assert.AreEqual("01", model.GroentijdenSets[0].Groentijden[0].FaseCyclus);
            Assert.AreEqual("02", model.GroentijdenSets[0].Groentijden[1].FaseCyclus);
            Assert.AreEqual("03", model.GroentijdenSets[0].Groentijden[2].FaseCyclus);
            Assert.AreEqual("04", model.GroentijdenSets[0].Groentijden[3].FaseCyclus);
            Assert.AreEqual("05", model.GroentijdenSets[0].Groentijden[4].FaseCyclus);
        }
        public void DetectorenFasenTabAddDetectorCommand_Executed_DetectorAddedToRightFase()
        {
            var model = ControllerCreator.GetSmallControllerWithDetection();
            var vm    = new DetectorenFasenTabViewModel {
                Controller = model
            };

            Messenger.OverrideDefault(FakesCreator.CreateMessenger(model));
            DefaultsProvider.OverrideDefault(FakesCreator.CreateDefaultsProvider());
            TLCGenModelManager.OverrideDefault(FakesCreator.CreateModelManager(model));

            vm.OnSelected();
            vm.AddDetectorCommand.Execute(null);

            Assert.AreEqual(3, vm.Detectoren.Count);
            var fc = model.Fasen[0];

            Assert.AreEqual("011", fc.Detectoren[0].Naam);
            Assert.AreEqual("012", fc.Detectoren[1].Naam);
            Assert.AreEqual("013", fc.Detectoren[2].Naam);
        }
Ejemplo n.º 6
0
        public void RemoveGroentijdenSetCommand_RemoveSetInMiddleOfSetList_RemainingSetsRenamedCorrectly()
        {
            var model = new ControllerModel();

            Messenger.OverrideDefault(FakesCreator.CreateMessenger());
            SettingsProvider.OverrideDefault(FakesCreator.CreateSettingsProvider());
            DefaultsProvider.OverrideDefault(FakesCreator.CreateDefaultsProvider());
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "01"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "02"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "03"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "04"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "05"
            });
            var vm = new FasenGroentijdenSetsTabViewModel();

            vm.Controller = model;

            vm.AddGroentijdenSetCommand.Execute(null);
            vm.AddGroentijdenSetCommand.Execute(null);
            vm.AddGroentijdenSetCommand.Execute(null);
            vm.SelectedSet = vm.GroentijdenSets[1];
            vm.RemoveGroentijdenSetCommand.Execute(null);

            Assert.AreEqual("MG1", vm.GroentijdenSets[0].Naam);
            Assert.AreEqual("MG2", vm.GroentijdenSets[1].Naam);
        }
Ejemplo n.º 7
0
        public void RemoveGroentijdenSetCommand_LastSetRemovedFromModel_CannotExecuteAnymore()
        {
            var model = new ControllerModel();

            Messenger.OverrideDefault(FakesCreator.CreateMessenger());
            SettingsProvider.OverrideDefault(FakesCreator.CreateSettingsProvider());
            DefaultsProvider.OverrideDefault(FakesCreator.CreateDefaultsProvider());
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "01"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "02"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "03"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "04"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "05"
            });
            var vm = new FasenGroentijdenSetsTabViewModel();

            vm.Controller = model;

            vm.AddGroentijdenSetCommand.Execute(null);
            vm.AddGroentijdenSetCommand.Execute(null);
            vm.SelectedSet = vm.GroentijdenSets[0];
            vm.RemoveGroentijdenSetCommand.Execute(null);
            vm.SelectedSet = vm.GroentijdenSets[0];
            vm.RemoveGroentijdenSetCommand.Execute(null);

            Assert.False(vm.RemoveGroentijdenSetCommand.CanExecute(null));
        }
        public void RenameFase_LowerThanOthers_SortsCorrectlyAfterTabChange()
        {
            var model = new ControllerModel();

            Messenger.OverrideDefault(new Messenger());
            DefaultsProvider.OverrideDefault(FakesCreator.CreateDefaultsProvider());
            TLCGenModelManager.OverrideDefault(new TLCGenModelManager {
                Controller = model
            });
            TLCGenControllerDataProvider.OverrideDefault(FakesCreator.CreateControllerDataProvider(model));
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "03"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "04"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "07"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "08"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "09"
            });
            var vm = new FasenLijstTabViewModel();

            vm.Controller = model;

            vm.Fasen[4].Naam = "05";
            vm.OnDeselectedPreview();

            Assert.AreEqual("05", vm.Fasen[2].Naam);
            Assert.AreEqual("08", vm.Fasen[4].Naam);
        }
        public void AddFaseCommand_Executed5Times_5thFaseCorrectlyNamed()
        {
            var model = new ControllerModel();

            Messenger.OverrideDefault(new Messenger());
            DefaultsProvider.OverrideDefault(FakesCreator.CreateDefaultsProvider());
            TLCGenModelManager.OverrideDefault(new TLCGenModelManager {
                Controller = model
            });
            TLCGenControllerDataProvider.OverrideDefault(FakesCreator.CreateControllerDataProvider(model));
            var vm = new FasenLijstTabViewModel {
                Controller = model
            };

            vm.AddFaseCommand.Execute(null);
            vm.AddFaseCommand.Execute(null);
            vm.AddFaseCommand.Execute(null);
            vm.AddFaseCommand.Execute(null);
            vm.AddFaseCommand.Execute(null);

            Assert.AreEqual("05", model.Fasen[4].Naam);
        }
        public void RenameFase_HigherThanOthers_SortsModelCorrectlyAfterTabChange()
        {
            var model = new ControllerModel();

            Messenger.OverrideDefault(FakesCreator.CreateMessenger());
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "01"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "02"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "03"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "04"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "05"
            });
            FasenLijstTabViewModel vm = new FasenLijstTabViewModel();

            vm.Controller = model;

            vm.Fasen[2].Naam = "07";
            vm.OnDeselectedPreview();

            Assert.AreEqual(
                new string[5] {
                "01", "02", "04", "05", "07"
            },
                model.Fasen.Select(x => x.Naam).ToArray());
        }
        public void DetectorenFasenTabRemoveDetectorCommand_ExecutedWithMultipleDetectorsSelected_DetectorsRemovedFromModel()
        {
            var model = ControllerCreator.GetSmallControllerWithDetection();
            var vm    = new DetectorenFasenTabViewModel {
                Controller = model
            };
            var controllermodifiermock = FakesCreator.CreateControllerModifier();

            TLCGenControllerModifier.OverrideDefault(controllermodifiermock);

            vm.OnSelected();
            vm.SelectedFaseNaam   = "02";
            vm.SelectedDetectoren = new List <DetectorViewModel>
            {
                vm.Detectoren[0],
                vm.Detectoren[1],
                vm.Detectoren[2]
            };
            vm.RemoveDetectorCommand.Execute(null);

            controllermodifiermock.Received().RemoveDetectorFromController("021");
            controllermodifiermock.Received().RemoveDetectorFromController("022");
            controllermodifiermock.Received().RemoveDetectorFromController("023");
        }
        public void FasenTimersTabSelectedFase_TabDeselectedAndSelected_SelectedFaseEqual()
        {
            var model = new ControllerModel();

            TemplatesProvider.OverrideDefault(FakesCreator.CreateTemplatesProvider());
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "01"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "02"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "03"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "04"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "05"
            });
            var vm = new FasenLijstTimersTabViewModel {
                Controller = model
            };

            vm.OnSelected();
            vm.SelectedFaseCyclus = vm.Fasen[3];
            vm.OnDeselected();
            vm.OnSelected();

            Assert.True(object.ReferenceEquals(vm.SelectedFaseCyclus, vm.Fasen[3]));
        }
Ejemplo n.º 13
0
        public void FasenDetailsTabSelectedFase_TabDeselectedAndSelected_SelectedFaseEqual()
        {
            var model = new ControllerModel();

            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "01"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "02"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "03"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "04"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "05"
            });
            var vm = new FasenDetailsTabViewModel();

            vm.Controller = model;
            TLCGenControllerDataProvider.OverrideDefault(FakesCreator.CreateControllerDataProvider(model));

            vm.OnSelected();
            vm.SelectedFaseCyclus = vm.Fasen[3];
            vm.OnDeselected();
            vm.OnSelected();

            Assert.True(object.ReferenceEquals(vm.SelectedFaseCyclus, vm.Fasen[3]));
        }