diff --git a/Locale/RequestedLocaleKeys.cs b/Translation/RequestedTranslationKeys.cs similarity index 93% rename from Locale/RequestedLocaleKeys.cs rename to Translation/RequestedTranslationKeys.cs index 21bac8b..a97c832 100644 --- a/Locale/RequestedLocaleKeys.cs +++ b/Translation/RequestedTranslationKeys.cs @@ -41,7 +41,7 @@ namespace raven_integration ((JArray)a.ObjectResponse["data"]).Count.Should().Be(2); //Now ensure there are at least two keys in the fetched keys array - a = await Util.GetAsync("Translation/LocaleKeyCoverage", await Util.GetTokenAsync("CustomerLimited")); + a = await Util.GetAsync("Translation/TranslationKeyCoverage", await Util.GetTokenAsync("CustomerLimited")); Util.ValidateDataReturnResponseOk(a); Util.ValidateHTTPStatusCode(a, 200); diff --git a/Locale/Locale.cs b/Translation/Translation.cs similarity index 75% rename from Locale/Locale.cs rename to Translation/Translation.cs index a6555e9..f68d1e6 100644 --- a/Locale/Locale.cs +++ b/Translation/Translation.cs @@ -8,38 +8,38 @@ using System.Collections.Concurrent; namespace raven_integration { - public class Locale + public class Translation { /* - ImportLocale(ct, ResourceFolderPath, "en"); - id 1 - ImportLocale(ct, ResourceFolderPath, "es"); - id 2 - ImportLocale(ct, ResourceFolderPath, "fr"); - id 3 - ImportLocale(ct, ResourceFolderPath, "de"); - id 4 + ImportTranslation(ct, ResourceFolderPath, "en"); - id 1 + ImportTranslation(ct, ResourceFolderPath, "es"); - id 2 + ImportTranslation(ct, ResourceFolderPath, "fr"); - id 3 + ImportTranslation(ct, ResourceFolderPath, "de"); - id 4 */ [Fact] - public async void LocalePickListWorks() + public async void TranslationPickListWorks() { //Get all ApiResponse a = await Util.GetAsync("Translation/picklist", await Util.GetTokenAsync("CustomerLimited"));//lowest level test user because there are no limits on this route except to be authenticated Util.ValidateDataReturnResponseOk(a); Util.ValidateHTTPStatusCode(a, 200); - //there should be at least 4 of them as there are 4 stock locales + //there should be at least 4 of them as there are 4 stock translations ((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(3); } [Fact] - public async void GetFullLocaleWorks() + public async void GetFullTranslationWorks() { //Get all ApiResponse a = await Util.GetAsync("Translation/1", await Util.GetTokenAsync("CustomerLimited"));//lowest level test user because there are no limits on this route except to be authenticated Util.ValidateDataReturnResponseOk(a); Util.ValidateHTTPStatusCode(a, 200); //there should be dozens of keys but at times there might only be a few during development so at least verify there is more than one - ((JArray)a.ObjectResponse["data"]["localeItems"]).Count.Should().BeGreaterThan(0); + ((JArray)a.ObjectResponse["data"]["translationItems"]).Count.Should().BeGreaterThan(0); } @@ -85,12 +85,12 @@ namespace raven_integration a.ObjectResponse["data"]["stock"].Value().Should().Be(false); a.ObjectResponse["data"]["id"].Value().Should().BeGreaterThan(4); a.ObjectResponse["data"]["concurrencyToken"].Value().Should().BeGreaterThan(0); - ((JArray)a.ObjectResponse["data"]["localeItems"]).Count.Should().BeGreaterThan(0); + ((JArray)a.ObjectResponse["data"]["translationItems"]).Count.Should().BeGreaterThan(0); long NewId = a.ObjectResponse["data"]["id"].Value(); //UPDATE - //Update locale name + //Update translation name /* @@ -105,7 +105,7 @@ namespace raven_integration d2.id = NewId; d2.newText = Util.Uniquify("INTEGRATION-TEST-LOCALE NAME UPDATE"); d2.concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value(); - ApiResponse PUTTestResponse = await Util.PutAsync("Translation/UpdateLocaleName", await Util.GetTokenAsync("BizAdminFull"), d2.ToString()); + ApiResponse PUTTestResponse = await Util.PutAsync("Translation/UpdateTranslationName", await Util.GetTokenAsync("BizAdminFull"), d2.ToString()); Util.ValidateHTTPStatusCode(PUTTestResponse, 200); @@ -115,28 +115,28 @@ namespace raven_integration //uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value(); - //Update locale key - var FirstLocaleKey = ((JArray)a.ObjectResponse["data"]["localeItems"])[0]; - long UpdatedLocaleKeyId = FirstLocaleKey["id"].Value(); - d2.id = UpdatedLocaleKeyId; + //Update translation key + var FirstTranslationKey = ((JArray)a.ObjectResponse["data"]["translationItems"])[0]; + long UpdatedTranslationKeyId = FirstTranslationKey["id"].Value(); + d2.id = UpdatedTranslationKeyId; d2.newText = Util.Uniquify("INTEGRATION-TEST-LOCALEITEM DISPLAY UPDATE"); - d2.concurrencyToken = FirstLocaleKey["concurrencyToken"].Value(); + d2.concurrencyToken = FirstTranslationKey["concurrencyToken"].Value(); - string UpdatedLocaleKey = FirstLocaleKey["key"].Value(); + string UpdatedTranslationKey = FirstTranslationKey["key"].Value(); - PUTTestResponse = await Util.PutAsync("Translation/UpdateLocaleItemDisplayText", await Util.GetTokenAsync("BizAdminFull"), d2.ToString()); + PUTTestResponse = await Util.PutAsync("Translation/UpdateTranslationItemDisplayText", await Util.GetTokenAsync("BizAdminFull"), d2.ToString()); Util.ValidateHTTPStatusCode(PUTTestResponse, 200); - //create user that is set to new locale so can use getSubset + //create user that is set to new translation so can use getSubset var Login = Util.Uniquify("LOGIN"); var Password = Util.Uniquify("PASSWORD"); dynamic DUSER = new JObject(); - DUSER.name = Util.Uniquify("LocaleUpdateSubsetTestUser"); + DUSER.name = Util.Uniquify("TranslationUpdateSubsetTestUser"); DUSER.active = true; DUSER.login = Login; DUSER.password = Password; - DUSER.roles = 0;//norole (any role can get a subset of locale keys) + DUSER.roles = 0;//norole (any role can get a subset of translation keys) DUSER.translationId = NewId; DUSER.userType = 3;//non scheduleable //Required by form custom rules @@ -149,7 +149,7 @@ namespace raven_integration List keys = new List(); - keys.AddRange(new string[] { UpdatedLocaleKey }); + keys.AddRange(new string[] { UpdatedTranslationKey }); dynamic d3 = new JObject(); d3 = JToken.FromObject(keys); @@ -158,9 +158,9 @@ namespace raven_integration Util.ValidateDataReturnResponseOk(checkPUTWorked); Util.ValidateHTTPStatusCode(checkPUTWorked, 200); ((JArray)checkPUTWorked.ObjectResponse["data"]).Count.Should().Be(1); - var FirstLocaleKeyUpdated = ((JArray)checkPUTWorked.ObjectResponse["data"])[0]; + var FirstTranslationKeyUpdated = ((JArray)checkPUTWorked.ObjectResponse["data"])[0]; - FirstLocaleKeyUpdated["value"].Value().Should().Be(d2.newText.ToString()); + FirstTranslationKeyUpdated["value"].Value().Should().Be(d2.newText.ToString()); //DELETE TEMPORARY USER SO CAN DELETE LOCALE a = await Util.DeleteAsync("User/" + DUSERID.ToString(), await Util.GetTokenAsync("manager", "l3tm3in")); diff --git a/User/UserOptions.cs b/User/UserOptions.cs index 6432b17..6fc86c4 100644 --- a/User/UserOptions.cs +++ b/User/UserOptions.cs @@ -23,10 +23,8 @@ namespace raven_integration D1.active = true; D1.login = Util.Uniquify("LOGIN"); D1.password = Util.Uniquify("PASSWORD"); - D1.roles = 0;//norole - D1.translationId=1; - D1.userType = 3;//non scheduleable - //Required by form custom rules + D1.roles = 0;//norole + D1.userType = 3;//non scheduleable D1.notes = "notes"; D1.customFields = Util.UserRequiredCustomFieldsJsonString(); @@ -44,15 +42,16 @@ namespace raven_integration uint concurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value(); //UPDATE - + //PUT dynamic D2 = new JObject(); - D2.EmailAddress = "testuseroptions@helloayanova.com"; - D2.LanguageOverride = "de-DE"; - D2.TimeZoneOverride = "Europe/Berlin"; - D2.CurrencyName = "EUR"; - D2.Hour12 = false; - D2.UiColor = -2097216;//Int value (no suffix for int literals) + D2.translationId = 1; + D2.emailAddress = "testuseroptions@helloayanova.com"; + D2.languageOverride = "de-DE"; + D2.timeZoneOverride = "Europe/Berlin"; + D2.currencyName = "EUR"; + D2.hour12 = false; + D2.uiColor = "#ffaaff"; D2.concurrencyToken = concurrencyToken; ApiResponse PUTTestResponse = await Util.PutAsync("UserOptions/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), D2.ToString()); Util.ValidateHTTPStatusCode(PUTTestResponse, 200); @@ -64,13 +63,13 @@ namespace raven_integration /* "{\"data\":{\"id\":44,\"concurrencyToken\":7144348,\"emailAddress\":null,\"uiColor\":0,\"languageOverride\":null,\"timeZoneOverride\":null,\"currencyName\":\"USD\",\"hour12\":true,\"userId\":44}}" */ - R.ObjectResponse["data"]["emailAddress"].Value().Should().Be(D2.EmailAddress.ToString()); - R.ObjectResponse["data"]["languageOverride"].Value().Should().Be(D2.LanguageOverride.ToString()); - R.ObjectResponse["data"]["timeZoneOverride"].Value().Should().Be(D2.TimeZoneOverride.ToString()); - R.ObjectResponse["data"]["currencyName"].Value().Should().Be(D2.CurrencyName.ToString()); - R.ObjectResponse["data"]["hour12"].Value().Should().Be((bool)D2.Hour12); - - R.ObjectResponse["data"]["uiColor"].Value().Should().Be((int)D2.UiColor); + R.ObjectResponse["data"]["emailAddress"].Value().Should().Be(D2.emailAddress.ToString()); + R.ObjectResponse["data"]["languageOverride"].Value().Should().Be(D2.languageOverride.ToString()); + R.ObjectResponse["data"]["timeZoneOverride"].Value().Should().Be(D2.timeZoneOverride.ToString()); + R.ObjectResponse["data"]["currencyName"].Value().Should().Be(D2.currencyName.ToString()); + R.ObjectResponse["data"]["hour12"].Value().Should().Be((bool)D2.hour12); + R.ObjectResponse["data"]["uiColor"].Value().Should().Be(D2.uiColor.ToString()); + R.ObjectResponse["data"]["translationId"].Value().Should().Be((long)D2.translationId); concurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value();