Blog - Microsoft .NET, ASP.NET, AJAX and more

Book Review – Manning The Art of Unit Testing

by Damien White 9/30/2009 3:57:11 PM

The Art of Unit TestingTo some, “unit testing” is a four letter word.  While it’s unfortunate, the feeling is justified by poor experiences, lack of knowledge, and so on.  Personally, I’ve had mixed experiences with unit tests.  I’m sure many of you have encountered similar situations.  After reading The Art of Unit Testing by Roy Osherove, I feel far more confident in not only understanding unit tests, but also the best practices for implementation.  If this book had only been written years ago, maybe all those poor unit testing experiences would have never happened. 

The fundamental thing that I think is most misunderstood about unit testing is simply not understanding what a unit test is.  In fact, Roy just recently posted an updated definition of how he would classify a unit test on his blog.  Of course a definition isn’t always enough, and in his book, Roy starts off by fully explaining all the aspects of what a unit test should be and the basic outline for how to succeed.  I would highly recommend that you visit his book’s webpage (http://manning.com/osherove/) and download the sample first chapter

This seriously may be the best book ever written on unit testing.  I understand that “the best” is a strong statement, but this book is really the perfect package.  Let’s look at what makes this such a winner… More...

Shout it kick it on DotNetKicks.com Bookmark and Share
Tags:
Categories: Review | C#
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Get and Set Properties using .NET Reflection

by Cedric Boudoya 9/29/2008 5:13:03 PM

Introduction

I would like to set the text value on a textbox control. It sounds easy enough. First, I would like to create a textbox web control then I would like to access one of its properties "Text" and set the text to "Hello World". Well what do you need to do to write your code in a generic way so you are can abstraction of the fact that the web control is actually a text box, it could be any web control.

We will visit different ways to be able to this.
More...

Shout it kick it on DotNetKicks.com Bookmark and Share
Tags: ,
Categories: .NET | C# | Reflection
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

ASP.NET AJAX Page Methods

by Damien White 9/7/2008 12:38:26 AM

Page Methods - Basic ExampleIf you've read things of mine, such as my Wrox Blox Hands On ASP.NET AJAX Control Toolkit, or posts on the ASP.NET Forums, you may have noticed I talk about using ASP.NET AJAX Page Methods lots of the time.  Lots of developers using ASP.NET AJAX overuse the UpdatePanel, or use it in situations where it doesn't make sense.  One example of this that I explore in my book is the comparison between using an UpdatePanel for a cascading drop-down effect vs. using the ASP.NET AJAX Control Toolkit's CascadingDropDown Control with Page Methods.  In short, the CascadingDropDown was far more efficient.  Most of the time the reasoning for choosing the UpdatePanel is that developers don't "think" about the repercussions of the UpdatePanel, nor do they think about other approaches to the problems they're trying to solve.  One of my favorite posts on UpdatePanels that I constantly refer developers to is Dave Ward's blog post titled "Why ASP.NET AJAX UpdatePanels Are Dangerous".  The post does a great job of discussing the point of UpdatePanel overuse and gives an example of using Page Methods for a task instead of the UpdatePanel.  Since I still encounter developers who fall into the UpdatePanel trap, I figured it would be a good idea to discuss Page Methods a bit further.

More...

Shout it kick it on DotNetKicks.com Bookmark and Share

C# 3.0 - Auto-Implemented Read-Only Properties

by Damien White 8/22/2008 7:41:45 PM
Technorati Tags:

This isn't a new topic by far, but I still encounter the question of how to implement a read-only auto-implemented property, so here it goes. 

As I'm sure you are aware, C# 3.0 has a wonderful feature known as auto-implemented properties (sometimes referred to as Automatic Properties).  These clean up our code quite a bit when we have properties that are simply backed by a private member, and all we do it get and set that value. More...

Shout it kick it on DotNetKicks.com Bookmark and Share
Tags: , ,
Categories: .NET | C#
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

ObjectDataSource, SOA Style

by Dave Marini 8/18/2008 11:43:00 PM

It's been entirely too long since my last post, and with the olympics in full swing, we'll go with a volleyball theme for this post.


BUMP

So here's the scenario. After really digging your teeth into ASP.NET 2.0 and playing around wiih all the cool data access features, you decide to apply a liberal use of the ObjectDataSource for its ability to take care of the paging and sorting calls for you. Now, you begin to convert your site to a service oriented back end and you wonder how you're going to make calls against your web service. You have a few options in front of you. You can create a thin facade layer that will act as a liaison between your presentation code and your service layer calls, and hook your ObjectDataSource to that. This works especially well when you have a complex object model that makes use of the web service calls behind the scenes. It's also beneficial when you are generating your proxy classes from metadata or contacting a foreign web service. In the scenario I'm going to demonstrate here, I'm referencing a shared contract and service library, so I'll be using using the ObjectDataSource to make direct calls to ChannelFactory<T> for this example.

More...


Shout it kick it on DotNetKicks.com Bookmark and Share
Tags:
Categories: .NET | ASP.NET | C# | Reflection | WCF | Web Services
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed