Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the remainder of the inflector tests: capitalize, uncapitalize,…
… ordinalize, and dasherize
- Loading branch information
1 parent
85baff2
commit 19b2453
Showing
7 changed files
with
139 additions
and
88 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Inflector.Tests | ||
{ | ||
[TestFixture] | ||
public class CapitalizeTests : InflectorTestBase | ||
{ | ||
[Test] | ||
public void Capitalize() | ||
{ | ||
foreach (var pair in TestData) | ||
{ | ||
Assert.AreEqual(Inflector.Capitalize(pair.Key), pair.Value); | ||
} | ||
} | ||
|
||
public CapitalizeTests() | ||
{ | ||
//Capitalizes the first char and lowers the rest of the string | ||
TestData.Add("some title", "Some title"); | ||
TestData.Add("some Title", "Some title"); | ||
TestData.Add("SOMETITLE", "Sometitle"); | ||
TestData.Add("someTitle", "Sometitle"); | ||
TestData.Add("some title goes here", "Some title goes here"); | ||
TestData.Add("some TITLE", "Some title"); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Inflector.Tests | ||
{ | ||
[TestFixture] | ||
public class DasherizeTests : InflectorTestBase | ||
{ | ||
[Test] | ||
public void Dasherize() | ||
{ | ||
foreach (var pair in TestData) | ||
{ | ||
Assert.AreEqual(Inflector.Dasherize(pair.Key), pair.Value); | ||
} | ||
} | ||
|
||
public DasherizeTests() | ||
{ | ||
//Just replaces underscore with a dash | ||
TestData.Add("some_title", "some-title"); | ||
TestData.Add("some-title", "some-title"); | ||
TestData.Add("some_title_goes_here", "some-title-goes-here"); | ||
TestData.Add("some_title and_another", "some-title and-another"); | ||
} | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Inflector.Tests | ||
{ | ||
[TestFixture] | ||
public class OrdinalizeTests : InflectorTestBase | ||
{ | ||
[Test] | ||
public void Ordinalize() | ||
{ | ||
foreach (var pair in TestData) | ||
{ | ||
Assert.AreEqual(Inflector.Ordinalize(pair.Key), pair.Value); | ||
} | ||
} | ||
|
||
public OrdinalizeTests() | ||
{ | ||
TestData.Add("0", "0th"); | ||
TestData.Add("1", "1st"); | ||
TestData.Add("2", "2nd"); | ||
TestData.Add("3", "3rd"); | ||
TestData.Add("4", "4th"); | ||
TestData.Add("5", "5th"); | ||
TestData.Add("6", "6th"); | ||
TestData.Add("7", "7th"); | ||
TestData.Add("8", "8th"); | ||
TestData.Add("9", "9th"); | ||
TestData.Add("10", "10th"); | ||
TestData.Add("11", "11th"); | ||
TestData.Add("12", "12th"); | ||
TestData.Add("13", "13th"); | ||
TestData.Add("14", "14th"); | ||
TestData.Add("20", "20th"); | ||
TestData.Add("21", "21st"); | ||
TestData.Add("22", "22nd"); | ||
TestData.Add("23", "23rd"); | ||
TestData.Add("24", "24th"); | ||
TestData.Add("100", "100th"); | ||
TestData.Add("101", "101st"); | ||
TestData.Add("102", "102nd"); | ||
TestData.Add("103", "103rd"); | ||
TestData.Add("104", "104th"); | ||
TestData.Add("110", "110th"); | ||
TestData.Add("1000", "1000th"); | ||
TestData.Add("1001", "1001st"); | ||
|
||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Inflector.Tests | ||
{ | ||
[TestFixture] | ||
public class UncapitalizeTests : InflectorTestBase | ||
{ | ||
[Test] | ||
public void Uncapitalize() | ||
{ | ||
foreach (var pair in TestData) | ||
{ | ||
Assert.AreEqual(Inflector.Uncapitalize(pair.Key), pair.Value); | ||
} | ||
} | ||
|
||
public UncapitalizeTests() | ||
{ | ||
//Just lowers the first char and leaves the rest alone | ||
TestData.Add("some title", "some title"); | ||
TestData.Add("some Title", "some Title"); | ||
TestData.Add("SOMETITLE", "sOMETITLE"); | ||
TestData.Add("someTitle", "someTitle"); | ||
TestData.Add("some title goes here", "some title goes here"); | ||
TestData.Add("some TITLE", "some TITLE"); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
A copy of the Inflector .NET class, originally written (I believe) by Andrew Peters, as well as unit tests of the class. | ||
|
||
I added tests of each Inflector method, since I couldn't find a description anywhere on the web of what each method does. |