Latest Microsoft Blogs

Browse by Tags

Related Posts

  • Speaking at Tech-Ed 2008 Hong Kong

    If you happen to be in Asia around October 8-10, I’ll be speaking at Tech-Ed Hong Kong . Come by and say hi. I’m giving three talks, one on each day. October 8 11:45 AM – 1:00 PM ASP.NET MVC - An alternative approach to building Web Applications October 9 11:00 AM – 12:15 PM Developing Data Driven Applications Using ASP.NET Dynamic Data October 10 9:30 AM – 10:45 AM Write better designed code with Test Driven Development I’m hoping to have a little time after some of my talks to go do a little sight-seeing around Hong Kong. The trip to Hong Kong is actually a side trip from Japan where my wife and kid will stay while I go and and speak at this conference. I’m looking forward to the vacation, but wish I had scheduled the vacation part after the...


  • ASP.NET MVC Application Building: Forums #5 – Membership

    In this series of blog posts, I build an entire ASP.NET MVC Forums application from start to finish. In this post, I explain how to test and implement authentication and authorization for the Forums application. Before you read this blog post, you should read the previous posts in this series: ASP.NET MVC Application Building: Forums #1 – Create the Perfect Application – In this first entry, I explain the overall goals of the ASP.NET MVC Forums application. I emphasize the importance of Software Design Principles and justify my choice to use test-driven development. ASP.NET MVC Application Building: Forums #2 – Create the First Unit Test – In the second entry, I build the first unit test and create the Index() action...


  • ASP.NET MVC Application Building: Forums #4 – Server-Side Form Validation

    In this series of blog entries, I build an entire ASP.NET MVC forums application from start to finish. In this blog entry, I add server-side form validation to the forums application. Before reading this blog entry, you should read the previous three blog entries in this series: ASP.NET MVC Application Building: Forums #1 – Create the Perfect Application – In this first entry, I explain the overall goals of the ASP.NET MVC Forums application. I emphasize the importance of Software Design Principles and justify my choice to use test-driven development. ASP.NET MVC Application Building: Forums #2 – Create the First Unit Test – In the second entry, I build the first unit test and create the Index() action which returns a...


  • ASP.NET MVC Application Building: Forums #3 – Post Messages

    In this series of blog entries, I build an entire ASP.NET MVC forums application from start to finish. In this blog entry, I add the functionality to the Forums application that enables users to post new messages and replies. Before reading this blog entry, you should read the previous two blog entries in this series: ASP.NET MVC Application Building: Forums #1 – Create the Perfect Application – In this first entry, I explain the overall goals of the ASP.NET MVC Forums application. I emphasize the importance of Software Design Principles and justify my choice to use test-driven development. ASP.NET MVC Application Building: Forums #2 – Create the First Unit Test – In the second entry, I build the first unit test and create...


  • ASP.NET MVC Application Building: Forums #2 – Create the First Unit Test

    In this series of blog entries, I build an entire ASP.NET MVC Forums application from scratch. In this blog entry, I create my first unit test for the Forums application and implement the code necessary to pass the test. Before reading this blog entry, you might want to read the first entry in this series: ASP.NET MVC Application Building: Forums #1 – Create the Perfect Application – Describes the goals of the ASP.NET MVC Forums application. Create the ASP.NET MVC Application Let me start by creating a new ASP.NET MVC application. Launch Visual Studio 2008 and select the menu option File, New Project. Select the ASP.NET MVC Web Application project type, give the project the name MvcForums, and click the OK button. When the dialog...


  • Streamlined BDD Using SubSpec for xUnit.NET

    I admit, up until now I’ve largely ignored the BDD (Behavior Driven Development) Context/Specification style of writing unit tests. It’s been touted as a more approachable way to learn TDD (Test Driven Development) and as a more natural transition from user stories to the actual code design. I guess my hesitation to give it a second thought was that I felt I didn’t need a more approachable form of TDD. Recently, my Subtext partner in crime, Steve Harman , urged me to take another fresh look at BDD Context/Specification style tests. I trust Steve’s opinion, so I took another look and in doing so, the benefits of this approach dawned on me. I realized that it wasn’t BDD itself I didn’t like, after all, I did enjoy writing specs using minispec...


  • ASP.NET MVC Tip #30 – Create Custom Route Constraints

    In this tip, I show how you can create custom route constraints that prevent you from accessing a URL unless you are local and authenticated. I show you how you can create a LocalConstraint and an AuthenticatedConstraint. I also demonstrate how you can test your custom constraints. When you create an MVC route, you can add constraints to a route. For example, the following route maps browser requests to a controller named Blog and an action named Archive: routes.MapRoute( "BlogArchive", "Archive/{entryDate}", new { controller = "Blog", action = "Archive" } ); This route, named BlogArchive, maps three parameters. The controller parameter is assigned the value Blog and the action parameter is assigned the...


  • What Integrated Circuits Say About Testing Your Code

    A while back I talked about how testable code helps manage complexity . In that post, I mentioned one common rebuttal to certain design decisions made in code in order to make it more testable. Why would I want to do XYZ just do improve testability? Recently, I heard one variation of this comment in the comments to my post on unit test boundaries . Several people suggested that it’s fine to have unit tests access the database, after all, the code relies on data from the database, it should be tested. Implicit in this statement is the question, “ Why would I want to abstract away the data access just to improve testability? ” Keep in mind, I never said you shouldn’t test your code’s interaction with the database. You absolutely should. I merely...


  • ASP.NET MVC Tip #28 – Test If Caching Is Enabled

    In this tip, I demonstrate how you can test if the OutputCache attribute is present on a controller action. I also demonstrate how you can test if the OutputCache attribute is set with a particular duration. Caching is the most effective way to improve the performance of an ASP.NET MVC application. The slowest operation that you can perform in a web application is database access. The best way to improve database access performance is to not access the database at all. Caching enables you to avoid having to access the database with each and every request. You can cache the view (or any Action Result) returned by a controller action by adding an OutputCache attribute to the controller action. For example, the controller in Listing 1 is configured...


  • ASP.NET MVC Tip #27 – Create ASP.NET MVC Specific Visual Studio Add-Ins

    In this tip, I discuss Eric Hexter’s TDD Class Generator Add-In for Visual Studio. This Add-In enables you to generate a class, an interface, and a test class by entering a single keyboard shortcut. Eric Hexter -- who has done valuable work on the MvcContrib project -- visited Microsoft last week and showed me one of his current projects. He has started a project for building ASP.NET MVC specific Add-Ins for Visual Studio. In particular, he has created an Add-In for generating testable classes automatically. You can learn more about the project, and download the binaries and source code, from the following website: http://erichexter.googlecode.com/svn/trunk/TestFirstGenerator/ You also can view a quick video walk-through of the Add-In...


Page 1 of 3 (24 items) 1 2 3 Next >
Microsoft Communities