Ejemplo n.º 1
0
        public void ThrowsWhenWritingBigValueToShortVariable(double value, bool throwsException)
        {
            var variable = new Variable("A%", new short[] { });
            var sut      = new VariableReference(variable, new short[] { });

            Test.Throws <IllegalQuantityException>(() => sut.SetValue(new Accumulator(value)), throwsException);
        }
Ejemplo n.º 2
0
        public void CanWriteAndReadToShortArrayVariable()
        {
            var variable = new Variable("A%", new short[] { 6, 6 });
            var sut      = new VariableReference(variable, new short[] { 2, 2 });

            sut.SetValue(new Accumulator(-3000.0));
            Assert.AreEqual(-3000, sut.GetValue().ValueAsShort());
            Assert.IsFalse(sut.IsString);
        }
Ejemplo n.º 3
0
        public void CanWriteAndReadToDoubleArrayVariable()
        {
            var variable = new Variable("A", new short[] { 7, 7 });
            var sut      = new VariableReference(variable, new short[] { 4, 4 });

            sut.SetValue(new Accumulator(40000.25));
            Assert.AreEqual(40000.25, sut.GetValue().ValueAsDouble());
            Assert.IsFalse(sut.IsString);
        }
Ejemplo n.º 4
0
        public void CanWriteAndReadToStringVariable()
        {
            var variable = new Variable("A$", new short[] { });
            var sut      = new VariableReference(variable, new short[] { });

            sut.SetValue(new Accumulator("HELLO"));
            Assert.AreEqual("HELLO", sut.GetValue().ValueAsString());
            Assert.IsTrue(sut.IsString);
        }