Exemplo n.º 1
0
 public VariableDynamicPage(VariableDynamic var)
 {
     InitializeComponent();
     mVariableDynamic = var;
     App.ObjFieldBinding(ValueExpressionTextBox, TextBox.TextProperty, var, nameof(VariableDynamic.ValueExpression));
     ValueExpressionTextBox.Init(mVariableDynamic, nameof(VariableDynamic.ValueExpression));
     mVariableDynamic.PropertyChanged += mVariableDynamic_PropertyChanged;
 }
Exemplo n.º 2
0
 public VariableDynamicPage(VariableDynamic var, Context context)
 {
     InitializeComponent();
     mContext         = context;
     mVariableDynamic = var;
     GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ValueExpressionTextBox, TextBox.TextProperty, var, nameof(VariableDynamic.ValueExpression));
     ValueExpressionTextBox.Init(mContext, mVariableDynamic, nameof(VariableDynamic.ValueExpression));
     mVariableDynamic.PropertyChanged += mVariableDynamic_PropertyChanged;
 }
Exemplo n.º 3
0
        public void DynamicVar_TestImageType()
        {
            //Arrange
            VariableDynamic variableDynamic = new VariableDynamic();

            //Act
            eImageType eImageType = variableDynamic.Image;

            //Assert
            Assert.AreEqual(eImageType.Random, eImageType, "Image Type");
        }
Exemplo n.º 4
0
        public void DynamicVar_TestVariableUIType()
        {
            //Arrange
            VariableDynamic variableDynamic = new VariableDynamic();

            //Act
            string varType = variableDynamic.VariableUIType;

            //Assert
            Assert.IsTrue(varType.Contains("Dynamic"), "Dynamic Variable UI Type");
        }
Exemplo n.º 5
0
        public void DynamicVar_TestVariableType()
        {
            //Arrange
            VariableDynamic variableDynamic = new VariableDynamic();

            //Act
            string varType = variableDynamic.VariableType();

            //Assert
            Assert.AreEqual("Dynamic", varType, "Dynamic Variable Type");
        }
Exemplo n.º 6
0
        public void DynamicVar_TestAutoValue()
        {
            //Arrange
            string valExpr = "{VBS Eval=1+1}";
            VariableDynamic variableDynamic = new VariableDynamic();
            variableDynamic.Name = "d1";
            variableDynamic.Value = valExpr;

            //Act
            variableDynamic.GenerateAutoValue();
            int num1 = Convert.ToInt32(variableDynamic.Value);

            //Assert            
            Assert.IsTrue(num1 >= 0 && num1 <= int.MaxValue, "num1 >= 0 && num1 <= int.max");
        }
Exemplo n.º 7
0
        public void DynamicVar_TestFormula()
        {
            //Arrange
            string valExpr = "{VBS Eval=2+2}";
            string expectedResult = "4";

            VariableDynamic variableDynamic = new VariableDynamic();
            variableDynamic.Name = "d1";
            variableDynamic.Value = valExpr;

            //Act
            string formulaVal = variableDynamic.GetFormula();

            //Assert            
            Assert.AreEqual(expectedResult, formulaVal, "Dynamic Variable Formula");
        }