Skip to content

Instantly share code, notes, and snippets.

@AlanPBourke
Created April 5, 2023 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlanPBourke/cb615f95508a0639605cc7038fe5a7a2 to your computer and use it in GitHub Desktop.
Save AlanPBourke/cb615f95508a0639605cc7038fe5a7a2 to your computer and use it in GitHub Desktop.
using NUnit.Framework;
using PegasusIreland;
using System;
namespace RawPrintComTests
{
[TestFixture]
public class RawPrintTest
{
private string zplLabelString;
[SetUp]
protected void Setup()
{
zplLabelString = $"^XA{Environment.NewLine}";
zplLabelString += $"^BY2,3,{Environment.NewLine}";
zplLabelString += $"^FO30,30^B3N,N,70,N,N^FDADA0001^FS{Environment.NewLine}";
zplLabelString += $"^FO30,105^A0,20,20^FD*ADA0001*^FS{Environment.NewLine}";
zplLabelString += $"^FO430,75^A0,32,55^FDInvoice^FS{Environment.NewLine}";
zplLabelString += $"^BY2,3,{Environment.NewLine}";
zplLabelString += $"^FO30,125^B3N,N,70,N,N^FDref1^FS{Environment.NewLine}";
zplLabelString += $"^FO30,200^A0,20,20^FD*ref1*^FS{Environment.NewLine}";
zplLabelString += $"^BY2,3,{Environment.NewLine}";
zplLabelString += $"^FO30,225^B3N,N,70,N,N^FDref2^FS{Environment.NewLine}";
zplLabelString += $"^FO30,300^A0,20,20^FD*ref2*^FS{Environment.NewLine}";
zplLabelString += $"^XZ{Environment.NewLine}";
}
[Test]
public void TestLabelPrint()
{
var p = new RawPrintWrapper();
p.RawPrintString(@"OperaLabels", zplLabelString);
Assert.IsTrue(p.PrintSuccessful);
}
[Test]
public void TestLabelPrint_ZT230()
{
var zt230string = "^XA";
zt230string += "^FX Top section with logo, name and address.";
zt230string += "^CF0,10";
zt230string += "^FO10,10^FDIntershipping, Inc.^FS";
zt230string += "^CF0,10";
zt230string += "^FO10,25^FD1000 Shipping Lane^FS";
zt230string += "^FO10,50^FDShelbyville TN 38102^FS";
zt230string += "^FO10,65^FDUnited States (USA)^FS";
zt230string += "^FO10,80^GB700,3,3^FS";
zt230string += "^XZ";
var p = new RawPrintWrapper();
p.RawPrintString(@"ZDesigner ZT230-200dpi ZPL", zt230string);
Assert.IsTrue(p.PrintSuccessful);
}
[Test]
public void TestLabelPrint_WrongPrinter()
{
var p = new RawPrintWrapper();
p.RawPrintString(@"NonExistent", zplLabelString);
TestContext.Out.WriteLine(p.ErrorMessage);
Assert.IsFalse(p.PrintSuccessful);
}
[Test]
public void Print_Prnfile_type3printer_tofile()
{
var p = new RawPrintWrapper();
p.RawPrintFile(@"epson_type3_tofile", @"printfiles\\doc04119.out");
TestContext.Out.WriteLine(p.ErrorMessage);
Assert.IsTrue(p.PrintSuccessful);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment