Dan Crevier's Blog

In search of a better name...

Browse by Tags

Tagged Content List
  • Blog Post: 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...
  • Blog Post: 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...
  • Blog Post: 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...
  • Blog Post: 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...
  • Blog Post: 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...
  • Blog Post: 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...
  • Blog Post: What does runat=&quot;server&quot; 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...
  • Blog Post: 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...
Page 1 of 1 (8 items)