Ejemplo n.º 1
0
        public void EvaluationBasicTest()
        {
            Initialize(@"form ExampleBlock {
                statement S1 (text, ""abc"") ""You've failed to answer:"";

                statement S2 (yesno, yes) ""You've failed to answer:"";

                if (yes){}
                else {
                     if (S2)
                        {}
                     else {};
                     };
                }
            ");
            Assert.IsTrue(Builder.RunEvaluators());
            TextWrapper tw = new TextWrapper("abc");
            TextWrapper tw_from_code = Builder.DataContext.ValueReferenceTable.GetValueOrNull("S1") as TextWrapper;
            Assert.IsTrue((tw_from_code == tw).Value.Value);

            Assert.IsTrue(new YesnoWrapper(true).Value==((YesnoWrapper)Builder.DataContext.ValueReferenceTable.GetValueOrNull("S2")).Value);
        }
Ejemplo n.º 2
0
        public void PlusOperatorTest()
        {
            //we expect that yesno should throw and exception but number and text should add, resp. concat.

            NumberWrapper na = new NumberWrapper(12345);
            NumberWrapper nb = new NumberWrapper(12345);

            TextWrapper ta = new TextWrapper("bla");
            TextWrapper tb = new TextWrapper("ble");

            Assert.AreEqual(24690, (na + nb).Value);
            Assert.AreEqual("blable", (ta + tb).Value);
        }
Ejemplo n.º 3
0
 public WidgetBase GetWidget(QuestionUnit unit, TextWrapper typeWrapper)
 {
     unit.InitialiseValue(typeWrapper);
     return new TextWidget(unit);
 }
 public bool Equals(TextWrapper obj)
 {
     return(Value == obj.Value);
 }
 protected static bool ContainsNullValue(TextWrapper a, TextWrapper b)
 {
     return(ReferenceEquals(a, null) || ReferenceEquals(b, null) || ReferenceEquals(null, a.Value) || ReferenceEquals(null, b.Value));
 }
Ejemplo n.º 6
0
 public bool Equals(TextWrapper obj)
 {
     return Value == obj.Value;
 }
Ejemplo n.º 7
0
 protected static bool ContainsNullValue(TextWrapper a, TextWrapper b)
 {
     return ReferenceEquals(a, null) || ReferenceEquals(b, null) || ReferenceEquals(null, a.Value) || ReferenceEquals(null, b.Value);
 }