Skip to content

Instantly share code, notes, and snippets.

@jdiamond
Created October 14, 2009 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdiamond/210497 to your computer and use it in GitHub Desktop.
Save jdiamond/210497 to your computer and use it in GitHub Desktop.
using System;
using NUnit.Framework;
namespace BehaveN.Tests
{
[TestFixture]
public class Describe_NameParser
{
[Test]
public void it_should_throw_an_exception_when_parsing_null()
{
(new Action(() => NameParser.Parse((string)null))).Should().Throw<ArgumentNullException>();
}
[Test]
public void it_should_return_an_empty_string_when_parsing_an_empty_string()
{
string result = NameParser.Parse("");
result.Should().Be.EqualTo("");
}
[Test]
public void it_should_return_the_same_string_when_parsing_a_single_word()
{
string result = NameParser.Parse("foo");
result.Should().Be.EqualTo("foo");
}
[Test]
public void it_should_return_two_strings_when_parsing_words_separated_by_semicolons()
{
string result = NameParser.Parse("foo_bar");
result.Should().Be.EqualTo("foo bar");
}
[Test]
public void it_should_return_two_strings_when_parsing_a_words_using_pascal_case()
{
string result = NameParser.Parse("FooBar");
result.Should().Be.EqualTo("Foo Bar");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment