Exemplo n.º 1
0
        public void VerifyQRCodeIsSameAsCallingFromEmitter(string emitter)
        {
            var             type = Assembly.LoadFrom("ESCPOS_NET").GetType($"ESCPOS_NET.Emitters.{emitter}", true);
            ICommandEmitter e    = (ICommandEmitter)Activator.CreateInstance(type);

            //Use Print Command so Buffer is updated internally
            var directPrinter = new DirectPrinter(e, null);

            directPrinter.PrintQRCode("ABC");

            byte[] expected = e.PrintQRCode("ABC");
            Assert.Equal(expected, directPrinter.Buffer);
        }
Exemplo n.º 2
0
        public void VerifyInternalBufferIsUpdated(string emitter)
        {
            var             type = Assembly.LoadFrom("ESCPOS_NET").GetType($"ESCPOS_NET.Emitters.{emitter}", true);
            ICommandEmitter e    = (ICommandEmitter)Activator.CreateInstance(type);

            //Use Print Command so Buffer is updated internally
            var directPrinter = new DirectPrinter(e, null);

            directPrinter.Print("ABC").Print("DEF");

            byte[] result = { 65, 66, 67, 68, 69, 70 };
            Assert.Equal(result, directPrinter.Buffer);
        }
Exemplo n.º 3
0
        public void VerifyInternalBufferIsCleared(string emitter)
        {
            var             type = Assembly.LoadFrom("ESCPOS_NET").GetType($"ESCPOS_NET.Emitters.{emitter}", true);
            ICommandEmitter e    = (ICommandEmitter)Activator.CreateInstance(type);

            //Use Print Command so Buffer is updated internally
            var directPrinter = new DirectPrinter(e, null);

            directPrinter.Print("ABC").Print("DEF");

            //Clear Buffer and adds different bytes
            directPrinter.ClearAll();
            directPrinter.Print("GHI").Print("JKL");

            byte[] result = { 71, 72, 73, 74, 75, 76 };
            Assert.Equal(result, directPrinter.Buffer);
        }