I have a project with three layers. User interface, business layer and data layer.
UI calls BL. BL calls DL. DL performs database operations. it's simple.
I wanted to unit test my BL methods, so I changed it a bit, and now I accept DL as a parameter in the BL constructor so that I can create a Mock DL object.
This forces me to change my user interface level, since my user interface calls my BL, and according to the rules of architecture, I think that this is not a good design if I add a link to my DL to my user interface.
Can anyone suggest a better way? Do I need to change the architecture, or am I doing something wrong here? Can I introduce Facade Manager here? An example of your suggestion would be much appreciated.
- Edit -
Here is the code:
in BL:
public MyBusinessLayer() { }
in the user interface:
//To do this i have to add DL reference to UI MyBusinessLater b = new MyBusinessLayer(new ISomeService());
Asdfg source share