Hi,
I am trying to write plugins which should be unit testable. I have divided the plugin into 2 parts as below.
1. Plugin class - class which will get register as plugin on particular event and will have validations whether plugin should execute or not.
2. Business logic class - which contains business logic as per requirement.
I have read articles mentioning that plugin class should not have class level variables. Do you see any problem with sample code snippet of plugin class (see below) as I have created 2 constructor in plugin class. One for CRM and other to use it for unit testing?
Sample:
public class Followup: IPlugin { readonly IFollowupBusinesslogic businessLogic; //Constructor for CRM public Followup() { businessLogic = new FollowupBusinesslogic(); } //Constructor for unit testing public Followup(IFollowupBusinesslogic businessLogic) { this.businessLogic = businessLogic; } public void Execute(IServiceProvider serviceProvider) { // code.... } }
Thanks in advance!!!
*This post is locked for comments