Skip to main content

Posts

Showing posts from March, 2009

Rails-like Unit Testing in MS MVC

While following the Professional ASP.NET MVC 1.0 sample chapter's section about Unit Testing, I decided to use NUnit because I do not have Visual Studio Professional. Because there is no wizard to create a Unit Test project in Visual Developer Express, I downloaded a NUnit MVC testing template and use it as my base project to complete the tutorial. The following are some different approaches I had to make in order to follow the tutorial: Instead of using [TestMethod] I used [Test], which what NUnit uses to mark test methods. I used the NUnit's GUI to perform the unit tests instead of using Visual Studio's since the Express version does not come with support for testing. The tutorial in the chapter shows you how to create a fake repository so that your unit tests do not use the database. Because I come from a Rails background where you actually have (or supposed to have) a separated database for testing, I decided to just copy the database and use the new copy for testing

DrySQL for the Microsoft MVC .NET framework

The sample Chapter 1 from Professional ASP.NET MVC 1.0 ( http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf ) is a great tutorial that guides you through the features of Microsoft's MVC framework . If you have used Rails before, when you read the tutorial you keep telling to yourself "wow, this is like rails but compiled and with excellent Intellisense and a nice and fast database backend". That's right, SQL Server is tightly coupled to the Linq to SQL framework that you can use as the ORM for the MS MVC (please note that the use of Linq to SQL is optional; and you could use other ORM frameworks). Just because is tightly coupled does not mean that is a bad idea; it actually integrates really well with the visual tools from Visual Studio. Here is a screen shot showing a basic overview of the database ORM mapping tool in MS Vistual Web Developer Express (which is free, like all the technologies described here, including the SQL server 2008 Express editio

Method for communication between drivers on the road

Have you ever wanted to warn somebody in front of you that there is a cop behind or that one of their tires is flat? Sometimes I see car that are smoking from behind and I want to warn the people inside the car; but how do I do that? do I just honk like crazy until they hear me? I would like to propose simple method for driver-to-driver communication using the high lights of your car: One dot (.) means flash your lights for a short time, about a second. A dash (-) means flashing them for about 4 seconds. ... : use it to alert the car in front of you that a high priority vehicle like a police car or an ambulance is behind trying to move around the traffic. -.- : use it to alert the car in front of you that something is wrong with their car (like a flat tire) and they should stop to check it. --. : use it to alert the car in front that one of the doors is open. I want also to mention that learning Morse code is good idea so that can you can communicate with your eye lids i

How to solve Named Pipes error 40 when connecting to local MS SQL Server instances

I was getting the following error when trying to add my local MS SQL server 2008 Express database to the data connections in Visual Web Developer 2008 Express : Named Pipes Provider, error: 40 - Could not open a connection to SQL Server The problem was that I was using just (local) in the server name field. To solve the problem, I had to add the instance name (sqlexpress) like this: (local)\sqlexpress When I entered that into the server name field, everything worked perfectly.