Answered by:
need help on unit test

Question
-
I am working on a wcf solution with entity framework by using vs2010. I want to do unit testing but I never did unit testing before. Anyone can suggest some tools, examples, tutorials for a solution built on wcf, ef?
Thanks
Friday, November 25, 2011 4:46 AM
Answers
-
Visual Studio 2010 and microsoft .net has its own unit testing framework and it is quite robust for Test Driven Development
http://msdn.microsoft.com/en-us/library/ms182515(v=VS.80).aspx
You can also integrate some open source tools like NUNIT ...
NUNIT is also feature complete product and strong community presence.
Tanvir Huda Application Architect/Consultant- Proposed as answer by Horizon_Net Friday, November 25, 2011 1:15 PM
- Marked as answer by peter 9 Tuesday, November 29, 2011 2:24 AM
Friday, November 25, 2011 5:56 AM -
On 11/24/2011 11:46 PM, peter 9 wrote:> I am working on a wcf solution with entity framework by using vs2010. I> want to do unit testing but I never did unit testing before. Anyone can> suggest some tools, examples, tutorials for a solution built on wcf, ef?>> Thanks><copied>Test is not a unit test if:•It talks to the database•It communicates across the network•It touches the file system•It can’t run at the same time as any of your other unit tests•You have to do special things to your environment (such as editingconfig files) to run it.
- Marked as answer by peter 9 Tuesday, November 29, 2011 2:24 AM
Friday, November 25, 2011 10:31 AM -
Hi,
You would be needing a unit-testing framework such as MSTest, NUnit etc. along with Mocking Library such as Rhino Mocks, Moq etc.
Mocking libraries are good to make mock or fake objects and together with testing framework they would help you in creating a pure unit test.
Hope this helps. Please feel free to discuss further.
Adil Mughal (MCPD, MCT, MVP) - http://AdilMughal.com- Marked as answer by peter 9 Tuesday, November 29, 2011 2:24 AM
Friday, November 25, 2011 10:45 AM -
You can test a function that returns complex objects. You're required to write the test code. For example, compare every object in the returned list with an expected list. Please ask the question on http://social.msdn.microsoft.com/Forums/en/vsunittest/threads for more information.
Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
If you have feedback about forum business, please contact msdnmg@microsoft.com. But please do not ask technical questions in the email.- Marked as answer by peter 9 Tuesday, November 29, 2011 2:24 AM
Monday, November 28, 2011 4:16 AM
All replies
-
Visual Studio 2010 and microsoft .net has its own unit testing framework and it is quite robust for Test Driven Development
http://msdn.microsoft.com/en-us/library/ms182515(v=VS.80).aspx
You can also integrate some open source tools like NUNIT ...
NUNIT is also feature complete product and strong community presence.
Tanvir Huda Application Architect/Consultant- Proposed as answer by Horizon_Net Friday, November 25, 2011 1:15 PM
- Marked as answer by peter 9 Tuesday, November 29, 2011 2:24 AM
Friday, November 25, 2011 5:56 AM -
On 11/24/2011 11:46 PM, peter 9 wrote:> I am working on a wcf solution with entity framework by using vs2010. I> want to do unit testing but I never did unit testing before. Anyone can> suggest some tools, examples, tutorials for a solution built on wcf, ef?>> Thanks><copied>Test is not a unit test if:•It talks to the database•It communicates across the network•It touches the file system•It can’t run at the same time as any of your other unit tests•You have to do special things to your environment (such as editingconfig files) to run it.
- Marked as answer by peter 9 Tuesday, November 29, 2011 2:24 AM
Friday, November 25, 2011 10:31 AM -
Hi,
You would be needing a unit-testing framework such as MSTest, NUnit etc. along with Mocking Library such as Rhino Mocks, Moq etc.
Mocking libraries are good to make mock or fake objects and together with testing framework they would help you in creating a pure unit test.
Hope this helps. Please feel free to discuss further.
Adil Mughal (MCPD, MCT, MVP) - http://AdilMughal.com- Marked as answer by peter 9 Tuesday, November 29, 2011 2:24 AM
Friday, November 25, 2011 10:45 AM -
Thank all of you.
>>Test is not a unit test if:>>•It talks to the databaseMy project is a database program, does this mean I cannot use unit test?Also I read some sample, it seems unit test only tests some simple (single) result, like a integer, a string. I have a function that queries database and returns a list of people with a lot of attributes like gender, DOB, address, phone,.etc. can unit test be used in this scenario?Monday, November 28, 2011 3:57 AM -
You can test a function that returns complex objects. You're required to write the test code. For example, compare every object in the returned list with an expected list. Please ask the question on http://social.msdn.microsoft.com/Forums/en/vsunittest/threads for more information.
Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
If you have feedback about forum business, please contact msdnmg@microsoft.com. But please do not ask technical questions in the email.- Marked as answer by peter 9 Tuesday, November 29, 2011 2:24 AM
Monday, November 28, 2011 4:16 AM