Created
December 19, 2009 22:13
-
-
Save ChrisMissal/260259 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal struct Tag | |
{ | |
private readonly string name; | |
private const string DEFAULT_TAG_NAME = "UnCategorized"; | |
public Tag(string name) | |
{ | |
this.name = name; | |
} | |
public string Name | |
{ | |
get { return name ?? DEFAULT_TAG_NAME; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void default_Tag_should_have_Name_of_UnCategorized() | |
{ | |
default(Tag).Name.ShouldEqual("UnCategorized"); | |
new Tag().Name.ShouldEqual("UnCategorized"); | |
Activator.CreateInstance<Tag>().Name.ShouldEqual("UnCategorized"); | |
} | |
[Fact] | |
public void list_of_tags_should_return_default() | |
{ | |
var list = new List<Tag>(); | |
list.Count.ShouldEqual(0); | |
var first = list.FirstOrDefault(); | |
first.Name.ShouldEqual("UnCategorized"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment