Ejemplo n.º 1
0
        public void Parse_OneCommandWithTwoParams_TwoParams()
        {
            var parser = new IntermecScanner();
            var tokens = parser.Scan(@"[ESC] XR; aaaa, bbbb [LF] [NUL] ");

            Assert.AreEqual(2, tokens.First().Parameters.Count());
        }
Ejemplo n.º 2
0
        public void Parse_OneCommandWithTwoParams_CommandExtracted()
        {
            var parser = new IntermecScanner();
            var tokens = parser.Scan(@"[ESC] XR; aaaa, bbbb [LF] [NUL] ");

            Assert.AreEqual("XR", tokens.First().Command);
        }
Ejemplo n.º 3
0
        public void Parse_OneCommandWithTwoParams_CommandExtracted()
        {
            var parser = new IntermecScanner();
            var tokens = parser.Scan(@"<STX>H0;o35,40;c25;<ETX>");

            Assert.AreEqual("H0", tokens.First().Command);
        }
Ejemplo n.º 4
0
        public void Parse_OneCommandWithTwoParams_TwoParams()
        {
            var parser = new IntermecScanner();
            var tokens = parser.Scan(@"<STX>H0;o35,40;c25;<ETX>");

            Assert.AreEqual(2, tokens.First().Parameters.Count());
        }
Ejemplo n.º 5
0
        public void Parse_OneCommandWithTwoParams_ParamsExtracted()
        {
            var parser = new IntermecScanner();
            var tokens = parser.Scan(@"[ESC] XR; aaaa, bbbb [LF] [NUL] ");
            var token  = tokens.First();

            Assert.AreEqual("aaaa", token.Parameters[0]);
            Assert.AreEqual("bbbb", token.Parameters[1]);
        }
Ejemplo n.º 6
0
        public void Parse_OneCommandWithTwoParams_ParamsExtracted()
        {
            var parser = new IntermecScanner();
            var tokens = parser.Scan(@"<STX>H0;o35,40;c25;<ETX>");
            var token  = tokens.First();

            Assert.AreEqual("o35,40", token.Parameters[0]);
            Assert.AreEqual("c25", token.Parameters[1]);
        }
Ejemplo n.º 7
0
        public void ParseTestLabel_ShouldRemoveTab()
        {
            var parser = new IntermecScanner();
            var label  = File.ReadAllText("IntermecLabel.txt");
            var tokens = parser.Scan(label);
            var tab    = tokens.Any(t => t.Command.Contains("\t"));

            Assert.IsFalse(tab);
        }
Ejemplo n.º 8
0
        public void ParseTestLabel_ShouldRemoveNewline()
        {
            var parser  = new IntermecScanner();
            var label   = File.ReadAllText("IntermecLabel.txt");
            var tokens  = parser.Scan(label);
            var newline = tokens.Any(t => t.Command.Contains("\n") || t.Command.Contains("\r"));

            Assert.IsFalse(newline);
        }