{{getMsg('Help_YouAreHere')}}:
/
{{page.title}}
{{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}}
{{helpModel.downloadHelpPdfDataStatus}}
Testing with NUnit
You can use the i-net PDFC Server to compare PDF files in your NUnit tests on any computer in your network. This can be done by your continuous integration server or from within the IDE of the developers.
Pre requirement
Before you can start with NUnit testing you need:
-
One installed i-net PDFC server instance.
-
The plugin JSON RPC must be activated and running. You can check this in the web-based Configuration Manager application, in the "Plugins" category.
Dependencies
In your test enviroment you need to add the required dependencies:
Visual Studio
For running the PDFC NUnit Tests in Visual Studio, additional NuGet packages are required:
-
the NUnit packages
-
the Newtonsoft.Json package
-
the PDFCNUnit package (find this in the NuGet package manager)
Sample Code
using NUnit.Framework; using PDFCNUnit.Inet.Pdfc; using System.Diagnostics; namespace PDFCNUnitTest { [TestFixture] public class PdfcAssertTest { [OneTimeSetUp] public void Init() { // the URL to the i-net PDFC server PdfcAssert.SetServicePath("http://localhost:9900"); // if the current windows user has no access to the server PdfcAssert.SetCredentials("user", "password"); // specify the PDFC settings to be used PdfcAssert.SetPdfcConfiguration("Text only"); // the default log level is SourceLevels.Warning // if you search for problems then you can enable the logging //PdfcAssert.SetLogLevel(SourceLevels.Verbose); } [Test] public void MyTest() { // compare if both files are equals PdfcAssert.AssertPdfEquals( "file1.pdf", "file2.pdf" ); } } }