Skip to content

Commit 6fefd9e

Browse files
authored
Merge pull request #1 from phnx47/master
Migrate to *.csproj. Support net4.5
2 parents 4591dbc + 53e7e41 commit 6fefd9e

File tree

10 files changed

+132
-73
lines changed

10 files changed

+132
-73
lines changed

Unidecode.NET.sln

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26228.4
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{604AAA61-6C9C-4421-9DA5-0805968113A8}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C9018F64-4917-4F4F-8F78-3A674896029D}"
99
ProjectSection(SolutionItems) = preProject
10-
global.json = global.json
1110
readme.md = readme.md
1211
EndProjectSection
1312
EndProject
14-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Unidecode.NET", "src\Unidecode.NET\Unidecode.NET.xproj", "{A1A9B022-442C-4782-AF37-F8E58E5740A3}"
13+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Unidecode.NET", "src\Unidecode.NET.csproj", "{3ED46251-F3F1-43F0-8776-A5055D96BB56}"
14+
EndProject
15+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8F8EB995-97FD-41CD-B307-E2F8E987C468}"
16+
EndProject
17+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Unidecode.NET.Tests", "test\Unidecode.NET.Tests.csproj", "{C93F3F13-BFB7-4440-BC52-B1BFAC74EB1B}"
1518
EndProject
1619
Global
1720
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1821
Debug|Any CPU = Debug|Any CPU
1922
Release|Any CPU = Release|Any CPU
2023
EndGlobalSection
2124
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22-
{A1A9B022-442C-4782-AF37-F8E58E5740A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23-
{A1A9B022-442C-4782-AF37-F8E58E5740A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
24-
{A1A9B022-442C-4782-AF37-F8E58E5740A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
25-
{A1A9B022-442C-4782-AF37-F8E58E5740A3}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{3ED46251-F3F1-43F0-8776-A5055D96BB56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26+
{3ED46251-F3F1-43F0-8776-A5055D96BB56}.Debug|Any CPU.Build.0 = Debug|Any CPU
27+
{3ED46251-F3F1-43F0-8776-A5055D96BB56}.Release|Any CPU.ActiveCfg = Release|Any CPU
28+
{3ED46251-F3F1-43F0-8776-A5055D96BB56}.Release|Any CPU.Build.0 = Release|Any CPU
29+
{C93F3F13-BFB7-4440-BC52-B1BFAC74EB1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{C93F3F13-BFB7-4440-BC52-B1BFAC74EB1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{C93F3F13-BFB7-4440-BC52-B1BFAC74EB1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
32+
{C93F3F13-BFB7-4440-BC52-B1BFAC74EB1B}.Release|Any CPU.Build.0 = Release|Any CPU
2633
EndGlobalSection
2734
GlobalSection(SolutionProperties) = preSolution
2835
HideSolutionNode = FALSE
2936
EndGlobalSection
3037
GlobalSection(NestedProjects) = preSolution
31-
{A1A9B022-442C-4782-AF37-F8E58E5740A3} = {604AAA61-6C9C-4421-9DA5-0805968113A8}
38+
{3ED46251-F3F1-43F0-8776-A5055D96BB56} = {604AAA61-6C9C-4421-9DA5-0805968113A8}
39+
{C93F3F13-BFB7-4440-BC52-B1BFAC74EB1B} = {8F8EB995-97FD-41CD-B307-E2F8E987C468}
3240
EndGlobalSection
3341
EndGlobal

global.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Unidecode.NET.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFrameworks>net45;netstandard1.3</TargetFrameworks>
4+
<PackageId>Unidecode.NET</PackageId>
5+
<VersionPrefix>1.1.0</VersionPrefix>
6+
<AssemblyName>Unidecode.NET</AssemblyName>
7+
<PackageId>Unidecode.NET</PackageId>
8+
<PackageTags>text;unicode;seo</PackageTags>
9+
<RepositoryType>git</RepositoryType>
10+
<RepositoryUrl>https://github.com/thecoderok/Unidecode.NET</RepositoryUrl>
11+
</PropertyGroup>
12+
13+
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
14+
</ItemGroup>
15+
16+
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
17+
</PropertyGroup>
18+
</Project>

src/Unidecode.NET/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/Unidecode.NET/Unidecode.NET.xproj

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Unidecode.NET/project.json

Lines changed: 0 additions & 18 deletions
This file was deleted.
File renamed without changes.

test/Unidecode.NET.Tests.csproj

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp1.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
9+
<PackageReference Include="xunit" Version="2.2.0" />
10+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\src\Unidecode.NET.csproj" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
19+
</ItemGroup>
20+
21+
</Project>

test/UnidecoderTest.cs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
using System;
2+
using System.Text;
3+
using Xunit;
4+
5+
namespace Unidecode.NET.Tests
6+
{
7+
public class UnidecoderTest
8+
{
9+
[Fact]
10+
public void DocTest()
11+
{
12+
Assert.Equal("Bei Jing ", "\u5317\u4EB0".Unidecode());
13+
}
14+
15+
[Fact]
16+
public void CustomTest()
17+
{
18+
Assert.Equal("Rabota s kirillitsey", "Работа с кириллицей".Unidecode());
19+
Assert.Equal("aouoAOUO", "äöűőÄÖŨŐ".Unidecode());
20+
}
21+
22+
[Fact]
23+
public void PythonTest()
24+
{
25+
Assert.Equal("Hello, World!", "Hello, World!".Unidecode());
26+
27+
Assert.Equal("'\"\r\n", "'\"\r\n".Unidecode());
28+
Assert.Equal("CZSczs", "ČŽŠčžš".Unidecode());
29+
Assert.Equal("a", "ア".Unidecode());
30+
Assert.Equal("a", "α".Unidecode());
31+
Assert.Equal("a", "а".Unidecode());
32+
Assert.Equal("chateau", "ch\u00e2teau".Unidecode());
33+
Assert.Equal("vinedos", "vi\u00f1edos".Unidecode());
34+
}
35+
36+
/// <summary>
37+
/// According to http://en.wikipedia.org/wiki/Romanization_of_Russian BGN/PCGN.
38+
/// http://en.wikipedia.org/wiki/BGN/PCGN_romanization_of_Russian
39+
/// With converting "ё" to "yo".
40+
/// </summary>
41+
[Fact]
42+
public void RussianAlphabetTest()
43+
{
44+
string russianAlphabetLowercase = "а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я";
45+
string russianAlphabetUppercase = "А Б В Г Д Е Ё Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я";
46+
47+
string expectedLowercase = "a b v g d e yo zh z i y k l m n o p r s t u f kh ts ch sh shch \" y ' e yu ya";
48+
string expectedUppercase = "A B V G D E Yo Zh Z I Y K L M N O P R S T U F Kh Ts Ch Sh Shch \" Y ' E Yu Ya";
49+
50+
Assert.Equal(expectedLowercase, russianAlphabetLowercase.Unidecode());
51+
Assert.Equal(expectedUppercase, russianAlphabetUppercase.Unidecode());
52+
}
53+
54+
[Fact]
55+
public void CharUnidecodeTest()
56+
{
57+
string input = "а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я А Б В Г Д Е Ё Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я";
58+
string expected = "a b v g d e yo zh z i y k l m n o p r s t u f kh ts ch sh shch \" y ' e yu ya A B V G D E Yo Zh Z I Y K L M N O P R S T U F Kh Ts Ch Sh Shch \" Y ' E Yu Ya";
59+
60+
var sb = new StringBuilder(expected.Length);
61+
foreach (char c in input)
62+
{
63+
sb.Append(c.Unidecode());
64+
}
65+
string result = sb.ToString();
66+
67+
Assert.Equal(expected, result);
68+
}
69+
70+
[Fact]
71+
public void UnidecodeOnNullShouldReturnEmptyString()
72+
{
73+
Assert.Equal("", ((string)null).Unidecode());
74+
}
75+
}
76+
}

0 commit comments

Comments
 (0)