GetDecimal() public method

Returns a decimal that contains the value of the specified variable.
public GetDecimal ( string name, decimal defaultValue ) : decimal
name string The name of the variable to be read.
defaultValue decimal The value to be returned if returns null.
return decimal
Exemplo n.º 1
0
        public void GetDecimal()
        {
            VariableAccessor va = new VariableAccessor(_testVariableSource);

            Assert.AreEqual((decimal)1, va.GetDecimal("ValidDecimal", 2.0m));
            Assert.AreEqual((decimal)2, va.GetDecimal("InvalidDecimal", 2.0m, false));
            va.GetDecimal("InvalidDecimal", 2, true);
        }
 public void GetDecimal()
 {
     VariableAccessor va = new VariableAccessor(_testVariableSource);
     Assert.AreEqual((decimal)1, va.GetDecimal("ValidDecimal", 2.0m));
     Assert.AreEqual((decimal)2, va.GetDecimal("InvalidDecimal", 2.0m, false));
     try
     {
         va.GetDecimal("InvalidDecimal", 2, true);
         Assert.Fail();
     }
     catch { }
 }