GetByte() public method

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

            Assert.AreEqual((byte)1, va.GetByte("ValidByte", 2));
            Assert.AreEqual((byte)2, va.GetByte("InvalidByte", 2, false));
        }
コード例 #2
0
 public void GetByte()
 {
     VariableAccessor va = new VariableAccessor(_testVariableSource);
     Assert.AreEqual((byte)1, va.GetByte("ValidByte", 2));
     Assert.AreEqual((byte)2, va.GetByte("InvalidByte", 2, false));
     try
     {
         va.GetByte("InvalidByte", 2, true);
         Assert.Fail();
     }
     catch { }
 }