Skip to content

Commit f282fad

Browse files
committed
Add unit test project
1 parent cbd6003 commit f282fad

26 files changed

Lines changed: 10878 additions & 0 deletions
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{2C6D4783-BC3C-41FC-8E7F-69BC209D949D}</ProjectGuid>
7+
<OutputType>Library</OutputType>
8+
<AppDesignerFolder>Properties</AppDesignerFolder>
9+
<RootNamespace>IdentityServer3.Contrib.Localization.UI.Tests</RootNamespace>
10+
<AssemblyName>IdentityServer3.Contrib.Localization.UI.Tests</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
15+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
16+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
17+
<IsCodedUITest>False</IsCodedUITest>
18+
<TestProjectType>UnitTest</TestProjectType>
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
21+
<DebugSymbols>true</DebugSymbols>
22+
<DebugType>full</DebugType>
23+
<Optimize>false</Optimize>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DefineConstants>DEBUG;TRACE</DefineConstants>
26+
<ErrorReport>prompt</ErrorReport>
27+
<WarningLevel>4</WarningLevel>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="System" />
39+
</ItemGroup>
40+
<Choose>
41+
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
42+
<ItemGroup>
43+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
44+
</ItemGroup>
45+
</When>
46+
<Otherwise>
47+
<ItemGroup>
48+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
49+
</ItemGroup>
50+
</Otherwise>
51+
</Choose>
52+
<ItemGroup>
53+
<Compile Include="TranslatorHelperTests.cs" />
54+
<Compile Include="Properties\AssemblyInfo.cs" />
55+
</ItemGroup>
56+
<ItemGroup>
57+
<ProjectReference Include="..\IdentityServer3.Contrib.Localization.UI\IdentityServer3.Contrib.Localization.UI.csproj">
58+
<Project>{3cf5c3ed-1e83-4c5c-ad32-cba295ba0b78}</Project>
59+
<Name>IdentityServer3.Contrib.Localization.UI</Name>
60+
</ProjectReference>
61+
</ItemGroup>
62+
<ItemGroup>
63+
<None Include="IdentityServer3.Contrib.Localization.UI.Tests.csproj.paket.references" />
64+
</ItemGroup>
65+
<Choose>
66+
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
67+
<ItemGroup>
68+
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
69+
<Private>False</Private>
70+
</Reference>
71+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
72+
<Private>False</Private>
73+
</Reference>
74+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
75+
<Private>False</Private>
76+
</Reference>
77+
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
78+
<Private>False</Private>
79+
</Reference>
80+
</ItemGroup>
81+
</When>
82+
</Choose>
83+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
84+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
85+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
86+
Other similar extension points exist, see Microsoft.Common.targets.
87+
<Target Name="BeforeBuild">
88+
</Target>
89+
<Target Name="AfterBuild">
90+
</Target>
91+
-->
92+
<Choose>
93+
<When Condition="($(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v3.5' Or $(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch')">
94+
<ItemGroup>
95+
<Reference Include="SecondLanguage">
96+
<HintPath>..\packages\SecondLanguage\lib\net35\SecondLanguage.dll</HintPath>
97+
<Private>True</Private>
98+
<Paket>True</Paket>
99+
</Reference>
100+
</ItemGroup>
101+
</When>
102+
</Choose>
103+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SecondLanguage
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("IdentityServer3.Contrib.Localization.UI.Tests")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("IdentityServer3.Contrib.Localization.UI.Tests")]
13+
[assembly: AssemblyCopyright("Copyright © 2015")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("561aa4be-c468-484d-aebf-ec42b2a5db4e")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using System.Globalization;
2+
using System.Threading;
3+
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
5+
namespace IdentityServer3.Contrib.Localization.UI.Tests
6+
{
7+
[TestClass]
8+
public class TranslatorHelperTests
9+
{
10+
11+
12+
[TestInitialize]
13+
public void Initialize()
14+
{
15+
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");
16+
}
17+
18+
[TestMethod]
19+
public void GetTranslatorForCurrentCultuer_ShouldBeOk()
20+
{
21+
var translator = TranslatorHelper.Instance.GetTranslatorForCurrentCulture();
22+
Assert.IsNotNull(translator);
23+
}
24+
25+
[TestMethod]
26+
public void TranslateSample_ShouldBeOk()
27+
{
28+
const string toTranslate = "[[common.error]]: [[login.username]] and [[login.password]] not set!";
29+
const string expected = "Error: Username and Password not set!";
30+
31+
var translated = TranslatorHelper.Instance.Translate(toTranslate);
32+
33+
Assert.AreEqual<string>(expected, translated);
34+
}
35+
36+
[TestMethod]
37+
public void TranslateStringWithNoGivenId_ShouldReturnId()
38+
{
39+
const string toTranslate = "[[this.is.no.existing.translation.id]]";
40+
const string expected = "this.is.no.existing.translation.id";
41+
42+
var translated = TranslatorHelper.Instance.Translate(toTranslate);
43+
44+
Assert.AreEqual<string>(expected, translated);
45+
}
46+
47+
[TestMethod]
48+
public void TranslateMoreComplicated_ShouldBeOk()
49+
{
50+
const string toTranslate = "[[logout.click]]<a ng-href=\"{{model.redirectUrl}}\">[[logout.here]]</a>[[logout.return]]";
51+
const string expected = "Click <a ng-href=\"{{model.redirectUrl}}\">here</a> to return to the";
52+
53+
var translated = TranslatorHelper.Instance.Translate(toTranslate);
54+
55+
Assert.AreEqual<string>(expected, translated);
56+
}
57+
}
58+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
msgid ""
2+
msgstr ""
3+
"Project-Id-Version: \n"
4+
"PO-Revision-Date: \n"
5+
"Last-Translator: \n"
6+
"Language-Team: \n"
7+
"MIME-Version: 1.0\n"
8+
"Content-Type: text/plain; charset=utf-8\n"
9+
"Content-Transfer-Encoding: 8bit\n"
10+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
11+
12+
msgid "common.error"
13+
msgstr "Fehler"
14+
15+
msgid "login.username"
16+
msgstr "Benutzername"
17+
18+
msgid "login.username.placeholder"
19+
msgstr "Benutzername"
20+
21+
msgid "login.password"
22+
msgstr "Passwort"
23+
24+
msgid "login.password.placeholder"
25+
msgstr "Passwort"
26+
27+
msgid "login.rememberLogin"
28+
msgstr "Angemeldet bleiben"
29+
30+
msgid "login.local"
31+
msgstr "Lokale Anmeldung"
32+
33+
msgid "login.title"
34+
msgstr "Anmeldung"
35+
36+
msgid "login.action"
37+
msgstr "Anmelden"
38+
39+
msgid "login.external"
40+
msgstr "Externe Anmeldung"
41+
42+
msgid "login.different"
43+
msgstr "Mit anderem Konto anmelden"
44+
45+
msgid "logout.title"
46+
msgstr "Abmeldung"
47+
48+
msgid "logout.info"
49+
msgstr "Sie wurden abgemeldet."
50+
51+
msgid "logout.click"
52+
msgstr "Klicken Sie "
53+
54+
msgid "logout.here"
55+
msgstr "hier"
56+
57+
msgid "logout.return"
58+
msgstr " um zu "
59+
60+
msgid "logout.application"
61+
msgstr " zurückzukehren."
62+
63+
msgid "logout.from"
64+
msgstr "Möchten Sie sich von "
65+
66+
msgid "logout.from2"
67+
msgstr " abmelden?"
68+
69+
msgid "logout.yes"
70+
msgstr "Ja"
71+
72+
msgid "consent.request"
73+
msgstr "fragt um Ihre Erlaubnis an"
74+
75+
msgid "consent.uncheck"
76+
msgstr "Wählen Sie die Berechtigungen ab, die Sie nicht erteilen möchten."
77+
78+
msgid "consent.personalInformation"
79+
msgstr "Persönliche Informationen"
80+
81+
msgid "consent.applicationAccess"
82+
msgstr "Anwendungszugriff"
83+
84+
msgid "consent.required"
85+
msgstr "(erforderlich)"
86+
87+
msgid "consent.rememberDecision"
88+
msgstr "Meine Entscheidung merken"
89+
90+
msgid "consent.allow"
91+
msgstr "Ja, erlauben"
92+
93+
msgid "consent.disallow"
94+
msgstr "Nein, nicht erlauben"
95+
96+
msgid "permissions.client"
97+
msgstr "Berechtigung für Client-Anwendung"
98+
99+
msgid "permissions.nonGranted"
100+
msgstr "Sie haben noch keiner Anwendung Berechtigungen erteilt"
101+
102+
msgid "permissions.identity"
103+
msgstr "Zugriff auf die Identität"
104+
105+
msgid "permissions.resource"
106+
msgstr "Zugriff auf Ressourcen"
107+
108+
msgid "permissions.revoke"
109+
msgstr "Zurücknehmen"
110+
111+
msgid "form.submit"
112+
msgstr "Daten übermitteln"
113+
114+
msgid "welcome.title"
115+
msgstr "IdentityServer v3"
116+
117+
msgid "welcome.nav.title"
118+
msgstr "IdentityServer3"
119+
120+
msgid "welcome.header"
121+
msgstr "Welcome to IdentityServer3"
122+
123+
msgid "welcome.build"
124+
msgstr "(build {version})"
125+
126+
msgid "welcome.info1"
127+
msgstr "IdentityServer veröffentlicht ein <a href=\"{applicationPath}/.well-known/openid-configuration\">Discovery Dokument</a> mit Metadaten und Links zu Endpunkten etc."
128+
129+
msgid "welcome.info2"
130+
msgstr "IdentityServer erlaubt es Benutzern bereits vergebene <a href=\"{applicationPath}/permissions\">Berechtigungen</a> anzusehen und zurück zu nehmen."
131+
132+
msgid "welcome.info3"
133+
msgstr "Hier sind die Link zu <a href=\"https://identityserver.github.io/Documentation\">Dokumentation</a>, und <a href=\"https://github.com/identityserver/Thinktecture.IdentityServer3.Samples\">anwendbare Beispiele</a>."

0 commit comments

Comments
 (0)