Example #1
0
        public void BoolVM()
        {
            var vm = new BoolVM();

            vm.EditValueProvider.String = "True";
            Assert.AreEqual(true, vm.Value);
            vm.EditValueProvider.String = "False";
            Assert.AreEqual(false, vm.Value);

            //Yes/No support
            vm.EditValueProvider.String = "Yes";
            Assert.AreEqual(true, vm.Value);
            vm.EditValueProvider.String = "No";
            Assert.AreEqual(false, vm.Value);

            //Ja/Nein support
            vm.EditValueProvider.String = "Ja";
            Assert.AreEqual(true, vm.Value);
            vm.EditValueProvider.String = "Nein";
            Assert.AreEqual(false, vm.Value);

            //Wahr/Falsch support
            vm.EditValueProvider.String = "Wahr";
            Assert.AreEqual(true, vm.Value);
            vm.EditValueProvider.String = "Falsch";
            Assert.AreEqual(false, vm.Value);
        }
        public void BoolVM_InitialValue_MustBe_False()
        {
            var vm = new BoolVM();

            Assert.That(vm.Value, Is.EqualTo(false));
            Assert.That(vm.EditValueProvider.BoolNullable, Is.EqualTo(false));
        }
        [Test, Ignore("TODO") /*behavior is to be defined*/]        // null => false | null => {Error} keep value unchanged
        public void BoolVM_SetNull_ShouldFail()
        {
            var vm = new BoolVM();

            vm.Value = true;                                                    // set the initial value
            vm.EditValueProvider.BoolNullable = null;                           // set the edit value
            Assert.That(vm.Value, Is.EqualTo(false));                           // ??
        }
        [Test]         // false => false
        public void BoolVM_SetFalse()
        {
            var vm = new BoolVM();

            vm.Value = true;                           //set the initial value			// set the initial value
            vm.EditValueProvider.BoolNullable = false; // set the edit value
            Assert.That(vm.Value, Is.EqualTo(false));  // compare
        }
        public MPCharacterConfigVM()
        {
            FirstPerks  = new SelectorVM <SelectorItemVM>(0, null);
            SecondPerks = new SelectorVM <SelectorItemVM>(0, null);

            IsHeroText             = new TextVM(GameTexts.FindText("str_ebt_is_hero"));
            MaleRatioText          = new TextVM(GameTexts.FindText("str_ebt_male_ratio"));
            FemaleRatioText        = new TextVM(GameTexts.FindText("str_ebt_female_ratio"));
            IsHero                 = new BoolVM(_config.IsHero);
            FemaleRatio            = new NumberVM <float>(_config.FemaleRatio, 0, 1, false);
            IsHero.OnValueChanged += b =>
            {
                _config.IsHero = b;
                SetCharacterToViewModel();
            };
            FemaleRatio.OnValueChanged += femaleRatio =>
            {
                _config.FemaleRatio = femaleRatio;
                SetCharacterToViewModel();
            };
        }
Example #6
0
        public void BoolVM_InitValueMustBe_False()
        {
            var vm = new BoolVM();

            Assert.AreEqual(false, vm.Value);
        }
Example #7
0
 public BoolView(BoolVM vm)
 {
     InitializeComponent();
     DataContext = vm;
 }