public void GetValueInvalidExpressionTest()
        {
            var model  = InstanceCreator.CreateInstance <TestModel>();
            var target = new ObjectValueProvider(model);

            Action test = () => target.GetValue("DOESNotExist");

            test.ShouldThrow <FormatException>();
        }
        public void GetValueTest3()
        {
            var model  = InstanceCreator.CreateInstance <TestModel>();
            var target = new ObjectValueProvider(model);

            var actual = target.GetValue("MyStringArray[0]");

            actual.Should()
            .Be(model.MyStringArray[0]);
        }
        public void GetValueTest2()
        {
            var model  = InstanceCreator.CreateInstance <TestModel>();
            var target = new ObjectValueProvider(model);

            var actual = target.GetValue("MyDouble");

            actual.Should()
            .Be(model.MyDouble.ToString(CultureInfo.InvariantCulture));
        }
        public void GetValueTest1()
        {
            var model  = InstanceCreator.CreateInstance <TestModel>();
            var target = new ObjectValueProvider(model);

            var actual = target.GetValue("MyInt32");

            actual.Should()
            .Be(model.MyInt32.ToString());
        }
        public void GetValueTest10()
        {
            var model  = InstanceCreator.CreateInstance <TestModel>();
            var target = new ObjectValueProvider(model);

            var actual = target.GetValue("SubModel.MyDictionaryStringSub[" + model.SubModel.MyDictionaryStringSub.First()
                                         .Key + "]");

            actual.Should()
            .Be(model.SubModel.MyDictionaryStringSub[model.SubModel.MyDictionaryStringSub.First()
                                                     .Key]);
        }
        public void GetValueTest6()
        {
            var model = new TestModel
            {
                MyListInt = new List <Int32>
                {
                    RandomValueEx.GetRandomInt32(),
                RandomValueEx.GetRandomInt32(),
                RandomValueEx.GetRandomInt32()
                }
            };
            var target = new ObjectValueProvider(model);

            var actual = target.GetValue("MyListInt[0]");

            actual.Should()
            .Be(model.MyListInt[0]
                .ToString());
        }
Example #7
0
 protected override void OnTrigger()
 {
     _variable.SetValue(_newValue.GetValue());
     End();
 }