I’m currently writing unit tests for the GemBox.Pdf library (.NET).
I’d like to implement both positive and negative test paths for license key loading.
However, I’ve noticed that this isn’t feasible — the license key can only be loaded once, regardless of whether it’s a valid key (e.g., "FREE-LIMITED-KEY"
) or an invalid one (e.g., "FakeLicence"
).
This limitation makes it impossible to fully test both scenarios in unit tests.
For example:
- If I load a valid key first and then an invalid one, I can still create an empty document using:
using (var document = new PdfDocument()) { } // yes, but only to check if licence is corretly
But if I load an invalid key first and then a valid one ("FREE-LIMITED-KEY"
), the same code:
using (var document = new PdfDocument()) { }
throws an exception, as if the license was never properly loaded.
Question:
Would it be possible to expose a property or method in ComponentInfo
(or elsewhere in GemBox.Pdf) that indicates whether the license was successfully loaded?