コード例 #1
0
        public void CommandhandlerConstructorWithArgsTest()
        {
            string[]       args   = null; // TODO: Initialize to an appropriate value
            Commandhandler target = new Commandhandler(args);

            Assert.IsNotNull(target);
        }
コード例 #2
0
        public void StartsWithKeywordTest()
        {
            Commandhandler target      = new Commandhandler();
            string         Keyword     = "Keyword";
            string         CommandLine = "Keyword in front of rest of line";
            bool           expected    = true;
            bool           actual;

            actual = target.StartsWithKeyword(Keyword, CommandLine);
            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void CommandhandlerTest_SkipTokenTest()
        {
            Commandhandler target      = new Commandhandler();
            string         Token       = "Keyword";
            string         CommandLine = "keyword. to find ";
            string         expected    = ". to find ";
            string         actual;

            actual = target.SkipToken(Token, CommandLine);
            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
        public void CommandTest_3_PrintExpresion_1Add2()
        {
            Commandhandler target             = new Commandhandler();
            string         CommandLine        = "print 1 + 2";
            string         ResultLine         = string.Empty;
            string         ResultLineExpected = "Unknown command";
            bool           expected           = false;
            bool           actual;

            actual = target.Command(ref CommandLine, out ResultLine);
            Assert.AreEqual(ResultLineExpected, ResultLine);
            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void TryParseTokenTest_TokenNotFound()
        {
            Commandhandler target              = new Commandhandler();
            string         Token               = "Keyword";
            string         CommandLine         = "token in front of line";
            string         CommandLineExpected = "token in front of line";
            bool           expected            = false;
            bool           actual;

            actual = target.TryParseToken(Token, ref CommandLine);
            Assert.AreEqual(CommandLineExpected, CommandLine);
            Assert.AreEqual(expected, actual);
        }
コード例 #6
0
        public void TryParseCharTest_CharNotFound()
        {
            Commandhandler target              = new Commandhandler();
            char           ch                  = 'W';
            string         CommandLine         = "word in front of rest of line";
            string         CommandLineExpected = "word in front of rest of line";
            bool           expected            = false;
            bool           actual;

            actual = target.TryParseChar(ch, ref CommandLine);
            Assert.AreEqual(CommandLineExpected, CommandLine);
            Assert.AreEqual(expected, actual);
        }
コード例 #7
0
        public void CommandhandlerTest_ReadTokenTest()
        {
            Commandhandler target        = new Commandhandler();
            string         CommandLine   = "keyword to find ";
            string         Token         = string.Empty;
            string         TokenExpected = "keyword";
            string         expected      = "to find ";
            string         actual;

            actual = target.ReadToken(CommandLine, out Token);
            Assert.AreEqual(TokenExpected, Token);
            Assert.AreEqual(expected, actual);
        }
コード例 #8
0
        public void ParseCharTest_CharFound()
        {
            Commandhandler target              = new Commandhandler();
            char           ch                  = 'K';
            string         CommandLine         = "K is found";
            string         CommandLineExpected = " is found";
            string         ResultLine          = string.Empty;
            string         ResultLineExpected  = string.Empty;
            bool           expected            = true;
            bool           actual;

            actual = target.ParseChar(ch, ref CommandLine, ref ResultLine);
            Assert.AreEqual(CommandLineExpected, CommandLine);
            Assert.AreEqual(ResultLineExpected, ResultLine);
            Assert.AreEqual(expected, actual);
        }
コード例 #9
0
        public void ParseTokenTest_TokenNotFound()
        {
            Commandhandler target              = new Commandhandler();
            string         Token               = "Keyword";
            string         CommandLine         = " keywor? to find ";
            string         CommandLineExpected = " keywor? to find ";
            string         ResultLine          = string.Empty;
            string         ResultLineExpected  = " Token 'Keyword' expected";
            bool           expected            = false;
            bool           actual;

            actual = target.ParseToken(Token, ref CommandLine, ref ResultLine);
            Assert.AreEqual(CommandLineExpected, CommandLine);
            Assert.AreEqual(ResultLineExpected, ResultLine);
            Assert.AreEqual(expected, actual);
        }
コード例 #10
0
        public void ParseCharTest_CharNotFound()
        {
            Commandhandler target              = new Commandhandler();
            char           ch                  = 'K';
            string         CommandLine         = "Char K is not first char and not found";
            string         CommandLineExpected = CommandLine;
            string         ResultLine          = string.Empty;
            string         ResultLineExpected  = " Char 'K' expected";
            bool           expected            = false;
            bool           actual;

            actual = target.ParseChar(ch, ref CommandLine, ref ResultLine);
            Assert.AreEqual(CommandLineExpected, CommandLine);
            Assert.AreEqual(ResultLineExpected, ResultLine);
            Assert.AreEqual(expected, actual);
        }
コード例 #11
0
        public void CommandhandlerConstructorNoArgsTest()
        {
            Commandhandler target = new Commandhandler();

            Assert.IsNotNull(target);
        }