Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted project to portable class lib for using with .net core and net4.6 #5

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
427c57b
Project converted from net3.5 to net4.5.2
abelepereira Sep 8, 2015
2cc9cc9
Upgraded project to Portable Class Lib w/ net4.6 and core5 profiles
abelepereira Sep 8, 2015
bbc8517
Added NuGet Package for distribution
abelepereira Sep 9, 2015
a000df5
Added support for net4.6+dxccore5+uwp10
abelepereira Sep 9, 2015
fc39b28
Added support for other languages
abelepereira Sep 9, 2015
d846637
Added support for a default culture
abelepereira Sep 10, 2015
a9187f4
Renamed tests specific to english culture
abelepereira Sep 10, 2015
552341c
Decreased public API surface
abelepereira Sep 10, 2015
80d52ce
Renamed english specific culture rules
abelepereira Sep 10, 2015
747b20d
Added portuguese language support
abelepereira Sep 10, 2015
8134cc6
decreased public API surface
abelepereira Sep 10, 2015
ba09bd8
Removed unnecessary ctor param
abelepereira Sep 10, 2015
96f143f
Added portuguese rules and nuget package definition
abelepereira Sep 10, 2015
03dacfc
Added portuguese tests
abelepereira Sep 10, 2015
1224063
Updated NuGet package
abelepereira Sep 10, 2015
a1192eb
Improved GitHub documentation readme
abelepereira Sep 10, 2015
9a464ea
Increase code coverage
abelepereira Sep 10, 2015
56e1fff
Improved documentation
abelepereira Sep 10, 2015
d4e2f09
Documentation update
abelepereira Sep 10, 2015
687b973
Improved fault tolerance when converting a singular to singular, by …
abelepereira Sep 11, 2015
e9562a5
Typo
abelepereira Sep 11, 2015
4b35238
Package updated for v1.2 release
abelepereira Sep 11, 2015
e2f7e38
Fixed testing errors on capitalize and dasherize
abelepereira Sep 11, 2015
080ef7a
Added support for changing the current custure rule set and minor opt…
abelepereira Sep 11, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Inflector.Portable.nupkg
Binary file not shown.
5 changes: 4 additions & 1 deletion Inflector.Tests/CapitalizeTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
using System.Globalization;
using NUnit.Framework;

namespace Inflector.Tests
{
Expand All @@ -8,6 +9,8 @@ public class CapitalizeTests : InflectorTestBase
[Test]
public void Capitalize()
{
Inflector.SetDefaultCultureFunc = () => new CultureInfo("en");

foreach (var pair in TestData)
{
Assert.AreEqual(pair.Key.Capitalize(), pair.Value);
Expand Down
69 changes: 69 additions & 0 deletions Inflector.Tests/CultureTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System;
using System.Globalization;
using NUnit.Framework;

namespace Inflector.Tests
{
[TestFixture]
public class CultureTests : InflectorTestBase
{
[SetUp]
public void Init()
{
Inflector.SetDefaultCultureFunc = null;
}

[Test]
public void DefaultCulture()
{
Inflector.SetDefaultCultureFunc = () => new CultureInfo("pt");

Assert.AreEqual("anéis", "anel".Pluralize());
}

[Test]
public void EnglishCulture()
{
var inflector = new Inflector(new CultureInfo("en"));

Assert.AreEqual("cats", inflector.Pluralize("cat"));
}

[Test]
public void MostSimilarCulture()
{
Inflector.SetDefaultCultureFunc = () => new CultureInfo("pt-PT");
Assert.AreEqual("homens", "homem".Pluralize());
}

[Test]
public void RuntimeCultureSwitch()
{
Inflector.SetDefaultCultureFunc = () => new CultureInfo("en");
Assert.AreEqual("indices", "index".Pluralize());

Inflector.SetDefaultCultureFunc = () => new CultureInfo("pt");
Assert.AreEqual("homens", "homem".Pluralize());
}

[Test]
public void UnsupportedCulture()
{
Assert.Catch<NotSupportedException>(() =>
{
var inflector = new Inflector(new CultureInfo("fr"));
var hommes = inflector.Pluralize("homme");
});
}

[Test]
public void UnsupportedDefaultCulture()
{
Assert.Catch<NotSupportedException>(() =>
{
Inflector.SetDefaultCultureFunc = () => new CultureInfo("fr");
var hommes = "homme".Pluralize();
});
}
}
}
5 changes: 4 additions & 1 deletion Inflector.Tests/DasherizeTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
using System.Globalization;
using NUnit.Framework;

namespace Inflector.Tests
{
Expand All @@ -8,6 +9,8 @@ public class DasherizeTests : InflectorTestBase
[Test]
public void Dasherize()
{
Inflector.SetDefaultCultureFunc = () => new CultureInfo("en");

foreach (var pair in TestData)
{
Assert.AreEqual(pair.Key.Dasherize(), pair.Value);
Expand Down
47 changes: 47 additions & 0 deletions Inflector.Tests/EnglishOrdinalizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System.Globalization;
using NUnit.Framework;

namespace Inflector.Tests
{
[TestFixture]
public class EnglishOrdinalizeTests : InflectorTestBase
{
public EnglishOrdinalizeTests()
{
Inflector.SetDefaultCultureFunc = () => new CultureInfo("en");
}

[TestCase(0, "0th")]
[TestCase(1, "1st")]
[TestCase(2, "2nd")]
[TestCase(3, "3rd")]
[TestCase(4, "4th")]
[TestCase(5, "5th")]
[TestCase(6, "6th")]
[TestCase(7, "7th")]
[TestCase(8, "8th")]
[TestCase(9, "9th")]
[TestCase(10, "10th")]
[TestCase(11, "11th")]
[TestCase(12, "12th")]
[TestCase(13, "13th")]
[TestCase(14, "14th")]
[TestCase(20, "20th")]
[TestCase(21, "21st")]
[TestCase(22, "22nd")]
[TestCase(23, "23rd")]
[TestCase(24, "24th")]
[TestCase(100, "100th")]
[TestCase(101, "101st")]
[TestCase(102, "102nd")]
[TestCase(103, "103rd")]
[TestCase(104, "104th")]
[TestCase(110, "110th")]
[TestCase(1000, "1000th")]
[TestCase(1001, "1001st")]
public void OrdanizeNumbersTest(int number, string ordanized)
{
Assert.AreEqual(number.Ordinalize(), ordanized);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
using NUnit.Framework;
using System.Globalization;
using NUnit.Framework;

namespace Inflector.Tests
{
[TestFixture]
public class PluralizeTests : InflectorTestBase
public class EnglishPluralizeTests : InflectorTestBase
{
[Test]
public void Pluralize()
public EnglishPluralizeTests()
{
foreach (var pair in TestData)
{
Assert.AreEqual(pair.Key.Pluralize(), pair.Value);
}
}

[Test]
public void Singularize()
{
foreach (var pair in TestData)
{
Assert.AreEqual(pair.Value.Singularize(), pair.Key);
}
}
Inflector.SetDefaultCultureFunc = () => new CultureInfo("en");

public PluralizeTests()
{
TestData.Add("search", "searches");
TestData.Add("switch", "switches");
TestData.Add("fix", "fixes");
Expand Down Expand Up @@ -120,7 +105,6 @@ public PluralizeTests()
TestData.Add("prize", "prizes");
TestData.Add("edge", "edges");

/* Tests added by Bas Jansen */
TestData.Add("goose", "geese");
TestData.Add("deer", "deer");
TestData.Add("sheep", "sheep");
Expand All @@ -130,6 +114,43 @@ public PluralizeTests()
TestData.Add("alumna", "alumnae");
TestData.Add("alumnus", "alumni");
TestData.Add("fungus", "fungi");

TestData.Add("list", "lists");
TestData.Add("customer", "customers");
}

[Test]
public void Pluralize()
{
foreach (var pair in TestData)
{
Assert.AreEqual(pair.Value, pair.Key.Pluralize());
}
}

[Test]
public void Singularize()
{
foreach (var pair in TestData)
{
Assert.AreEqual(pair.Key, pair.Value.Singularize());
}
}

[Test]
public void SingularizeSingular()
{
Assert.AreEqual("list", "list".Singularize());
Assert.AreEqual("information", "information".Singularize());
}

[Test]
public void PluralizePlural()
{
foreach (var pair in TestData)
{
Assert.AreEqual(pair.Key, pair.Value.Singularize());
}
}
}
}
16 changes: 11 additions & 5 deletions Inflector.Tests/Inflector.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -10,8 +10,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Inflector.Tests</RootNamespace>
<AssemblyName>Inflector.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -29,20 +31,24 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.5.9.10348\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="CapitalizeTests.cs" />
<Compile Include="CultureTests.cs" />
<Compile Include="DasherizeTests.cs" />
<Compile Include="PortuguesePluralizeTests.cs" />
<Compile Include="HumanizeTests.cs" />
<Compile Include="OrdinalizeTests.cs" />
<Compile Include="EnglishOrdinalizeTests.cs" />
<Compile Include="PascalizeAndCamelizeTests.cs" />
<Compile Include="PluralizeTests.cs" />
<Compile Include="EnglishPluralizeTests.cs" />
<Compile Include="InflectorTestBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TitleizeTests.cs" />
Expand All @@ -54,7 +60,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Inflector\Inflector.csproj">
<Project>{D5677360-4354-4BA3-9E23-DB169C22BEAB}</Project>
<Project>{d5677360-4354-4ba3-9e23-db169c22beab}</Project>
<Name>Inflector</Name>
</ProjectReference>
</ItemGroup>
Expand Down
85 changes: 0 additions & 85 deletions Inflector.Tests/OrdinalizeTests.cs

This file was deleted.

Loading