A A
RSS

Tag Archive | "moq"

Mocking and Dependency Injection in ASP.NET MVC

Wednesday, August 27, 2008

Comments

Here is the situation, my controller constructors take multiple interfaces as parameters.  I do this in order to use constructor injection which allows me to inject the controllers with mocked objects in my unit tests. For example, my AccountController takes IEmailService, IFormsAuthentication and MembershipProvider (abstract class) as parameters. During my testing, I want to mock the email, [...]

Unit Test Linq to Sql in ASP.Net MVC with Moq

Friday, April 4, 2008

Comments

I have just spent the entire day playing with Moq to unit test an asp.net mvc application I am working with. All I wanted to do is test a “create” method that simply adds a record to the database. So here it goes. 1. I created a Mock Http context to be used by my controller. [...]

Advertise Here

What I'm Doing...

Yonkly Open Source

Sign up for my newsletter

powered by MailChimp!

Cyber Identity