GetFloat() public method

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

            Assert.AreEqual((float)1, va.GetFloat("ValidFloat", 2.0f));
            Assert.AreEqual((float)2, va.GetFloat("InvalidFloat", 2.0f, false));
            va.GetFloat("InvalidFloat", 2, true);
        }
 public void GetFloat()
 {
     VariableAccessor va = new VariableAccessor(_testVariableSource);
     Assert.AreEqual((float)1, va.GetFloat("ValidFloat", 2.0f));
     Assert.AreEqual((float)2, va.GetFloat("InvalidFloat", 2.0f, false));
     try
     {
         va.GetFloat("InvalidFloat", 2, true);
         Assert.Fail();
     }
     catch { }
 }