GetChar() public method

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

            Assert.AreEqual('c', va.GetChar("ValidChar", 'a'));
            Assert.AreEqual('a', va.GetChar("InvalidChar", 'a', false));
            Assert.Throws <ArgumentException>(() => va.GetChar("InvalidChar", 'a', true));
        }
        public void GetChar()
        {
            VariableAccessor va = new VariableAccessor(_testVariableSource);

            Assert.AreEqual('c', va.GetChar("ValidChar", 'a'));
            Assert.AreEqual('a', va.GetChar("InvalidChar", 'a', false));
            try
            {
                va.GetChar("InvalidChar", 'a', true);
                Assert.Fail();
            }
            catch { }
        }
 public void GetChar()
 {
     VariableAccessor va = new VariableAccessor(_testVariableSource);
     Assert.AreEqual('c', va.GetChar("ValidChar", 'a'));
     Assert.AreEqual('a', va.GetChar("InvalidChar", 'a', false));
     try
     {
         va.GetChar("InvalidChar", 'a', true);
         Assert.Fail();
     }
     catch { }
 }