public void testBackwardsLanguage() { LanguageList list = getLanguageList(); Assert.NotNull(list); Assert.IsTrue(list.languages.Count > 0); TransfluentLanguage englishLanguage = list.getLangaugeByCode("en-us"); TransfluentLanguage lang = list.getLangaugeByCode(TransfluentLanguage.BACKWARDS_LANGUAGE_NAME); Assert.AreNotEqual(englishLanguage.code, 0); Assert.NotNull(lang); //post text key string textToSave = "this is sample text" + Random.value; var saveOp = new SaveTextKey ( language: englishLanguage.id, text: textToSave, text_id: HELLO_WORLD_TEXT_KEY ); bool saved = saveOp.Parse(justCall(saveOp)); Debug.Log("Saved successfullly:" + saved); var testForExistance = new GetTextKey ( languageID: englishLanguage.id, text_id: HELLO_WORLD_TEXT_KEY ); string keyFromDB = testForExistance.Parse(justCall(testForExistance)); Assert.IsFalse(string.IsNullOrEmpty(keyFromDB)); Assert.AreEqual(textToSave, keyFromDB); }
public void THIS_FAILS_testAlreadyInsertedException() { string textToSave = textToSetTestTokenTo + Random.value; var saveOp = new SaveTextKey ( language: englishLanguage.id, text: textToSave, text_id: TRANSLATION_KEY ); justCall(saveOp); justCall(saveOp); //error 500, this looks like a temporary server error... }
public void SetText(string textKey, string textValue, string groupKey = null) { if (currentLanguage == null) { throw new Exception("Must set current language first!"); } var saveText = new SaveTextKey (textKey, text: textValue, group_id: groupKey, language: currentLanguage.id); try { makeCall(saveText); } catch (CallException exception) { Debug.LogError("error making setText call:" + exception.Message); } }
public void SaveRetrieveKey(string keyToSaveAndThenGet, TransfluentLanguage language) { //post text key string textToSave = textToSetTestTokenTo + Random.value; var saveOp = new SaveTextKey ( language: language.id, text: textToSave, text_id: keyToSaveAndThenGet ); string callText = justCall(saveOp); Assert.IsTrue(saveOp.Parse(callText)); var testForExistance = new GetTextKey ( languageID: language.id, text_id: keyToSaveAndThenGet ); string stringFromServer = testForExistance.Parse(justCall(testForExistance)); Assert.IsFalse(string.IsNullOrEmpty(stringFromServer)); Assert.AreEqual(textToSave, stringFromServer); //save it back to what we expect it to be saveOp = new SaveTextKey ( language: language.id, text: textToSetTestTokenTo, text_id: keyToSaveAndThenGet ); callText = justCall(saveOp); Assert.IsTrue(saveOp.Parse(callText)); stringFromServer = testForExistance.Parse(justCall(testForExistance)); Assert.AreEqual(textToSetTestTokenTo, stringFromServer); }
public void SetText(string textKey, string textValue, string groupKey = null) { if(currentLanguage == null) throw new Exception("Must set current language first!"); var saveText = new SaveTextKey (textKey, text: textValue, group_id: groupKey, language: currentLanguage.id); try { makeCall(saveText); } catch(CallException exception) { Debug.LogError("error making setText call:" + exception.Message); } }