Closed RiteshKo closed 5 years ago
Hi @RiteshKo. This issue tracker's focus is on the development and maintenance of Moq, and that's what we'd like to focus our limited resources on. Pure usage questions (such as yours) are a better fit for places such as Stack Overflow, where your question will also meet with a much larger audience. For these reasons I'm opting to close this issue.
I have a common method which is being called multiple times(around 30-35 references in the project). This method is basically fetching data from DB into data table.
Following is the testable code:
I have mocked DB classes to not hit DB from unit tests. Following is the test case code:
I am mocking FillDataSetFromAdapter method and checking the value of CommandText to return what data. The mocked method is being called from GetData() method which is being called from the Task Factory and is calling three times to get 3 different types of data.
So the mocked method is called 3 times containing command text "abc","def","xyz". But every time Setup method is called for 3 types of queries it is calling only one Setup method which is resulting same data in data1,data2 and data3 in the Process method. I think for each call command text is only "abc" or "def" or "xyz" which results in calling only one Setup method.
And when I removed the Task factory dependency everything is working fine.
Any help??