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 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); }