Dan Crevier's Blog
In search of a better name...
Translate This Page
Translate this page
Tips & Tricks
Browse by Tags
Dan Crevier's Blog
Tagged Content List
A pattern for unit testable Asp.net pages: Part 4
Okay, now for unit tests of the code from part 3 . The goal is to completely cover RenamePageModel. First we need mock implementations of IPageContext and IDataAccess. For IPageContext, we are going to use special exception types for page not found and server errors. And, we'll add an accessor to track...
31 Jul 2007
A pattern for unit testable Asp.net pages: Part 3
In this post, I'm going to give an example of the pattern in action, built on the classes described in the last post . For the example, I've chosen something similar to the rename page on Live Folders . Here's how it should work: The Url should be of the form http://<server>/rename.aspx?path=<path...
26 Jul 2007
A pattern for unit testable Asp.net pages: Part 2
In part 1 , I gave an overview of the pattern. In this part, I will describe some of the core classes. Let's start off with the PageModel itself. It's the most simple. It is an abstract class. Subclasses must implement OnLoaded. It has an associated IPageContext (see below) that the model will use to...
24 Jul 2007
A pattern for unit testable Asp.net pages: Part 1
I previously blogged about the pattern we used in our WPF application to separate business logic from the presentation, making the business logic view and data models highly unit testable. Now that I'm working on Asp.net code for Live Folders , we've worked to come up with a similar model that separates...
21 Jul 2007
Gotcha with HttpResponse.Redirect
HttpResponse.Redirect is used to redirect to another page using a 302 response code. It can be used in two modes. One terminates the thread immediately so that execution does not continue to the next line of code. The other version continues execution, but returns a 302 response. The latter version is...
28 Mar 2007
The difference between <%= and <%# in ASP.NET
I was a little confused about the difference between <%= expression %> and <%# expression %> in ASP.NET. It seems like both work in a lot of cases, but in other cases, only the # (data binding) version works. So, I decided to dig into it a little bit. To try it out I built this simple page...
13 Feb 2007
What does runat="server" do for HTML controls
One thing I didn't fully understand when I first started using ASP.NET is exactly what runat="server" does. It sounds like some magical thing where code is running on the server for your control and not on the client. In some cases something like that does happen, but the basics are much simpler than...
17 Dec 2006
Playing with ASP.NET
I'm doing some ASP.NET work on my current project (more about that in the coming months). I've spent most of my life doing client side code, so it's taken me a little time to really wrap my head around what's happening with ASP.NET. It often seems like there's a lot of magic going on. But, once you look...
16 Dec 2006
Page 1 of 1 (8 items)
© 2015 Microsoft Corporation.
Privacy & Cookies