Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Jan 02, 2024 1:09 pm

We would like to unittest our application that is using Spire.PDF. For example, we would like to count the number of calls to pdfPageBase.Canvas.DrawString/Rectangle/etc. There seems to be no interface we can mock (with NSubstitute).

Is there a convenient way to mock Spire.PDF objects/classes to be able to unittest our own code without building a lot of proxy classes etc, only for unittesting purposes?

berrydictu
 
Posts: 25
Joined: Fri Dec 15, 2023 12:58 pm

Wed Jan 03, 2024 2:31 am

Hi,

Thank you for your inquiry.
Sorry, our product currently doesn‘t have such an interface or method to meet your needs. We deeply apologize for any inconvenience caused.

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Wed Jan 03, 2024 10:52 am

Thank you for your timely reply.
Are there any plans to add support for this? As dependency injection and testing like this is a common way of work, I think it would be a great value for your product.

berrydictu
 
Posts: 25
Joined: Fri Dec 15, 2023 12:58 pm

Thu Jan 04, 2024 3:30 am

Hi,

Thank you for your feedback.
Due to the many functions provided by our product, considering the iteration cycle of the product, supporting this approach as a whole would increase product complexity, so our product cannot provide support for your requirement at the moment. In addition, I asked our R&D team and they suggested that you try implementing your requirements in the form of secondary encapsulation code. We deeply apologize for any inconvenience caused.

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Return to Spire.PDF