Posts Tagged ‘TDD’

Validating culture name using LINQ

No Comments » | Tuesday, July 22nd, 2008

Imagine that we have some class (e.g. UserProfile) with Culture property for storing a culture specific string, in other words a culture name.

class UserProfile
{
    private string _culture;

    public string Culture
    {
        get { return _culture; }
        set { _culture = value; }
    }
}

Our goal is to allow only existing culture name to be set and avoid an invalid one. Let’s start by writing unit tests where we will try to assign valid and invalid values to our property (using MSTest):

(more…)

Hostgator is going to host .NET sites in the nearly future