public void MatchName_WrongName_3OptBefore()
        {
            string    varName = "Variable-Name";
            InputLine line    = MakeInputLine(varName);

            AssertLineHasValue(line, 1, varName);

            Assert.IsFalse(line.MatchOptionalName("optional.var.1"));
            Assert.IsFalse(line.MatchOptionalName("optional.var.2"));
            Assert.IsFalse(line.MatchOptionalName("optional.var.3"));

            TryMatchName(line, "required.variable.name");
        }
        public void MatchOptName_AtEnd()
        {
            InputLine line = MakeInputLine(null);

            AssertLineAtEnd(line);
            Assert.IsFalse(line.MatchOptionalName("expected.variable.name"));
        }
        public void MatchOptName_Whitespace()
        {
            string    varName = "Optional-Variable-Name";
            InputLine line    = MakeInputLine(" \t " + varName + " \r\n");

            AssertLineHasValue(line, 1, varName);
            Assert.IsTrue(line.MatchOptionalName(varName));
            AssertNoMoreLines(line);
        }
        public void MatchOptName_Missing()
        {
            string    varName = "Variable-Name";
            InputLine line    = MakeInputLine(varName);

            AssertLineHasValue(line, 1, varName);
            Assert.IsFalse(line.MatchOptionalName("optional.variable"));
            line.MatchName(varName);
            AssertNoMoreLines(line);
        }
        //---------------------------------------------------------------------

        private void TryMatchOptName(InputLine line,
                                     string name)
        {
            try {
                line.MatchOptionalName(name);
            }
            catch (System.Exception e) {
                Data.Output.WriteLine(e.Message);
                throw;
            }
        }