Skip to content

Commit

Permalink
Added tests for Hyphenate, sorted out whitespace issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanVSDev committed Jan 6, 2014
1 parent 672aef8 commit 5b81d32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Humanizer.Tests/InflectorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ public void Dasherize(string input, string expectedOutput)
Assert.Equal(input.Dasherize(), expectedOutput);
}

[InlineData("some_title", "some-title")]
[InlineData("some-title", "some-title")]
[InlineData("some_title_goes_here", "some-title-goes-here")]
[InlineData("some_title and_another", "some-title and-another")]
[Theory]
public void Hyphenate(string input, string expectedOutput)
{
Assert.Equal(input.Hyphenate(), expectedOutput);
}

[Theory]
[InlineData("customer", "Customer")]
[InlineData("CUSTOMER", "CUSTOMER")]
Expand Down
4 changes: 2 additions & 2 deletions src/Humanizer/InflectorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,14 @@ public static string Dasherize(this string underscoredWord)
return underscoredWord.Replace('_', '-');
}

/// <summary>
/// <summary>
/// Replaces underscores with hyphens in the string
/// </summary>
/// <param name="underscoredWord"></param>
/// <returns></returns>
public static string Hyphenate(this string underscoredWord)
{
return Dasherize(underscoredWord)
return Dasherize(underscoredWord);
}
}
}

0 comments on commit 5b81d32

Please sign in to comment.