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); }
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); }
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); }