Reputation: 11
I am working on a project which has 3 tier architecture:- 1. Business layer 2. Data layer 3. Service Layer
I want to unit test my Service layer.
Currently I succeeded to add a unit test to my Business layer by faking the Data Layer.
Now the issue is, I have a service layer which makes call to my Business layer, which in turn makes calls to my Data layer.
Initial test case that passed was written by adding a reference of Business layer project in my Unit test project and then creating Fakes of the Data layer.
Now what I want to do is, I want to achieve this by adding Reference of Service in the Unit test project and also using Microsoft Fakes at the same time.
Can someone please help me in understanding this? I am new to this Fakes framework.
Upvotes: 1
Views: 1347
Reputation: 268
This question is old, but hopefully it helps you, or someone in a search:
You seem (imho)to be mixing what is needed in your architecture(and/or integration testing) vs what is needed in unit testing. If you are trying to fake for unit testing, remember SUT! System Under Test should be the only component you are testing. In which case, if you are testing a component in your service layer you should fake(shim or stub) any calls external.
http://msdn.microsoft.com/en-us/library/hh549175.aspx Gives a good example with the IStockfeed stub.
Please clarify if you are trying to integration test or unit test.
Upvotes: 1