From 328dae1059118469fa6e0745b85c6700a44c3fa7 Mon Sep 17 00:00:00 2001 From: ryannewington Date: Sat, 9 Jul 2016 11:09:10 +1000 Subject: [PATCH 1/2] Adds initial support for getting and saving localized resources --- .../GetTests.cs | 20 + .../UnitTestHelper.cs | 6 + .../Lithnet.ResourceManagement.Client.csproj | 2 +- .../ResourceManagementClient.cs | 542 ++++++++++++++++-- .../ResourceObject.cs | 37 +- .../Schema/AttributeNames.cs | 5 + .../ServiceImplementation/MessageComposer.cs | 53 +- .../ServiceImplementation/ResourceClient.cs | 42 +- .../ServiceImplementation/SearchClient.cs | 19 +- .../SearchResultPager.cs | 8 +- 10 files changed, 626 insertions(+), 108 deletions(-) diff --git a/src/Lithnet.ResourceManagement.Client.UnitTests/GetTests.cs b/src/Lithnet.ResourceManagement.Client.UnitTests/GetTests.cs index e3288b5..76110dd 100644 --- a/src/Lithnet.ResourceManagement.Client.UnitTests/GetTests.cs +++ b/src/Lithnet.ResourceManagement.Client.UnitTests/GetTests.cs @@ -12,6 +12,26 @@ namespace Lithnet.ResourceManagement.Client.UnitTests [TestClass] public class GetTests { + [TestMethod] + public void TestLocale() + { + ResourceManagementClient client = new ResourceManagementClient(); + + try + { + //ResourceObject resource = client.GetResourceByKey("AttributeTypeDescription", "Name", "DisplayName", UnitTestHelper.TestCulture); + + ResourceObject resource = client.GetResource("7dcc83b6-8be7-4717-a1ac-62b0b1b7ce29", UnitTestHelper.TestCulture); + Assert.AreEqual(UnitTestHelper.TestCulture, resource.Locale); + //Nome visualizzato + } + finally + { + + } + } + + [TestMethod] public void GetObjectByIDWithAllAttributes() { diff --git a/src/Lithnet.ResourceManagement.Client.UnitTests/UnitTestHelper.cs b/src/Lithnet.ResourceManagement.Client.UnitTests/UnitTestHelper.cs index fd0eae7..de008e7 100644 --- a/src/Lithnet.ResourceManagement.Client.UnitTests/UnitTestHelper.cs +++ b/src/Lithnet.ResourceManagement.Client.UnitTests/UnitTestHelper.cs @@ -5,6 +5,7 @@ using Lithnet.ResourceManagement.Client; using Microsoft.ResourceManagement.WebServices; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Globalization; namespace Lithnet.ResourceManagement.Client.UnitTests { @@ -12,6 +13,9 @@ public static class UnitTestHelper { internal static ResourceManagementClient client = new ResourceManagementClient(); + internal const string TestLocale = "it-IT"; + internal static CultureInfo TestCulture = new CultureInfo(UnitTestHelper.TestLocale); + public static string TestDataString1 = "testString1"; public static string TestDataString2 = "testString2"; public static string TestDataString3 = "testString3"; @@ -84,6 +88,8 @@ public static class UnitTestHelper internal const string AttributeBinaryMV = "ut_mvbinary"; internal const string AttributeBooleanSV = "ut_svboolean"; + + static UnitTestHelper() { UnitTestHelper.PrepareRMSForUnitTests(); diff --git a/src/Lithnet.ResourceManagement.Client/Lithnet.ResourceManagement.Client.csproj b/src/Lithnet.ResourceManagement.Client/Lithnet.ResourceManagement.Client.csproj index b87d1ca..f1c5d47 100644 --- a/src/Lithnet.ResourceManagement.Client/Lithnet.ResourceManagement.Client.csproj +++ b/src/Lithnet.ResourceManagement.Client/Lithnet.ResourceManagement.Client.csproj @@ -209,7 +209,7 @@ - d:\NuGet\NuGet.exe pack $(ProjectPath) -Exclude **\*.xml + d:\NuGet\NuGet.exe pack $(ProjectPath) -OutputDirectory D:\nuget\packages -Exclude **\*.xml