Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hey,
 
I've posted about this application before and had some good responses, so hopefully you guys can help again.
 
I'm currently undertaking my final year of a Computer Science degree in the UK, and building an ASP.NET Web Forms CMS with an E-Commerce module as my final project.
 
I'm using N-Tier architecture, and used a few tutorials from here to create an Entities Layer, Data Access Layer, Business Logic Layer and Presentation Layer.
 
I'm looking in to unit testing the BLL to start with, but didn't use an ORM for the DAL, so I'm having trouble trying to cut out the database dependencies with a mocking framework.
 
An example flow of information through my App:
 
->Presentation calls the BLL GetProducts() method.
 
->BLL calls the DAL GetProducts() method which returns a list of product entities.
 
->DAL GetProducts method creates a list of product entities from the GetProductList() stored procedure in the database.
 
How would you go about unit testing the BLL, and integration testing the DAL? I'd rather not switch out to using an ORM such as EF or NHibernate as I produced a lot of documentation on the architecture that is being used so far, and any major changes would mean a lot more documentation to be written.
 
The majority of online information seems to be combining Moq with EF and MVC4.
 
Thanks in advance,
Stu.
Posted 3-Feb-13 7:07am
stuuz310
Comments
Kishor Deshpande at 3-Feb-13 21:49pm
   
So, basically you are trying to build a n-layer application in which you have DAL, BAL and Presentation layers separated. n- tier means you have your presentation at a separate server probably a web server, Database at another and Web Services deployed on separate machine.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
MSTest comes with Visual studio which is testing framework.
Now, when you think about isolation framework to remove external dependencies, most of the developers use Rhino Mocks.
If you really want to learn how you can write Unit tests for your BAL code without changing it to OR/M,
The best reference book is: The Art of Unit Testing
with Examples in .NET
by Roy Osherove
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

For unit testing the BLL, you can always consider using the Microsoft Visual Studio Testing Framework or a third party like Nunint.
For a mocking framework, you can consider using Moles[^].
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 940
1 OriginalGriff 543
2 Abhinav S 253
3 thatraja 245
4 Emre Ataseven 200
0 Sergey Alexandrovich Kryukov 8,282
1 OriginalGriff 4,750
2 Peter Leow 3,784
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid