Example #1
0
        public void Parse_OneCommandWithTwoParams_CommandExtracted()
        {
            var parser = new ZebraScanner();
            var tokens = parser.Scan(@"^BBarg1,arg2");

            Assert.AreEqual("BB", tokens.First().Command);
        }
Example #2
0
        public void Parse_OneCommandWithTwoParams_TwoParams()
        {
            var parser = new ZebraScanner();
            var tokens = parser.Scan(@"^BBarg1,arg2");

            Assert.AreEqual(2, tokens.First().Parameters.Count());
        }
Example #3
0
        public void Parse_OneCommandWithTwoParams_OneToken()
        {
            var parser = new ZebraScanner();
            var tokens = parser.Scan(@"^AAarg1,arg2");

            Assert.AreEqual(1, tokens.Count());
        }
Example #4
0
        public void Parse_Tilde_ExtractedAsCommand()
        {
            var parser = new ZebraScanner();
            var tokens = parser.Scan(@"~JR");
            var token  = tokens.First();

            Assert.AreEqual("JR", token.Command);
        }
Example #5
0
        public void Parse_OneLetterCommand_CommandExtracted()
        {
            var parser = new ZebraScanner();
            var tokens = parser.Scan(@"^Aarg1,arg2");
            var token  = tokens.First();

            Assert.AreEqual("A", token.Command);
        }
Example #6
0
        public void Parse_OneCommandWithTwoParams_ParamsExtracted()
        {
            var parser = new ZebraScanner();
            var tokens = parser.Scan(@"^BBarg1,arg2");
            var token  = tokens.First();

            Assert.AreEqual("arg1", token.Parameters[0]);
            Assert.AreEqual("arg2", token.Parameters[1]);
        }
Example #7
0
        public async Task <Label> CreateAsync(string label)
        {
            var scanner       = new ZebraScanner();
            var tokens        = scanner.Scan(label);
            var parser        = new ZebraParser();
            var concreteLabel = parser.Parse(tokens);

            return(await Task.FromResult(concreteLabel));
        }
Example #8
0
        public void TestMethod1()
        {
            var scanner = new ZebraScanner();
            var content = File.ReadAllText("TestLabel.txt");
            var tokens  = scanner.Scan(content);
            var parser  = new ZebraParser();
            var label   = parser.Parse(tokens);

            Assert.IsNotNull(label);
        }
Example #9
0
 public void ParseTestLabel_ShouldParseCommands()
 {
     var parser = new ZebraScanner();
     var label  = File.ReadAllText("TestLabel.txt");
     var tokens = parser.Scan(label);
 }