示例#1
0
        public void OnNameChanged_FaseRenamedLowerThanOthers_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 = "05"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "06"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "07"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "08"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "09"
            });
            var vm = new FasenGroentijdenSetsTabViewModel();

            vm.Controller = model;
            var vmfasen = new FasenLijstTabViewModel();

            vmfasen.Controller = model;

            vm.AddGroentijdenSetCommand.Execute(null);
            var oldname = vmfasen.Fasen[2].Naam;

            vmfasen.Fasen[2].Naam = "02";
            vm.OnNameChanged(new NameChangedMessage(TLCGenObjectTypeEnum.Fase, oldname, vmfasen.Fasen[2].Naam));

            Assert.AreEqual(
                new string[5] {
                "02", "05", "06", "08", "09"
            },
                vm.FasenNames.ToArray());
        }
        public void OnNameChanged_FaseRenamedLowerThanOthers_FaseNamedCorrectlyInGroentijdenSet()
        {
            var model = new ControllerModel();

            Messenger.OverrideDefault(FakesCreator.CreateMessenger());
            SettingsProvider.OverrideDefault(FakesCreator.CreateSettingsProvider());
            DefaultsProvider.OverrideDefault(FakesCreator.CreateDefaultsProvider());
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "05"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "06"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "07"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "08"
            });
            model.Fasen.Add(new FaseCyclusModel()
            {
                Naam = "09"
            });
            var vm = new FasenGroentijdenSetsTabViewModel();

            vm.Controller = model;
            var vmfasen = new FasenLijstTabViewModel();

            vmfasen.Controller = model;

            vm.AddGroentijdenSetCommand.Execute(null);
            string oldname = vmfasen.Fasen[2].Naam;

            vmfasen.Fasen[2].Naam = "02";
            vm.OnNameChanged(new NameChangedMessage(oldname, vmfasen.Fasen[2].Naam));

            Assert.AreEqual(
                new string[5] {
                "02", "05", "06", "08", "09"
            },
                model.GroentijdenSets[0].Groentijden.Select(x => x.FaseCyclus).ToArray());
        }