public async Task TestGetPreferredTranslators() { var mockedClient = new MockedGengoClient(); var group = new AccountMethodGroup(mockedClient); mockedClient.Json["account/preferred_translators"] = @" [ { ""translators"": [ { ""last_login"": 1375824155, ""number_of_jobs"": 5, ""id"": 8596 }, { ""last_login"": 1372822132, ""number_of_jobs"": 2, ""id"": 24123 } ], ""lc_tgt"": ""ja"", ""lc_src"": ""en"", ""tier"": ""standard"" }, { ""translators"": [ { ""last_login"": 1375825234, ""number_of_jobs"": 10, ""id"": 14765 }, { ""last_login"": 1372822132, ""number_of_jobs"": 1, ""id"": 3627 } ], ""lc_tgt"": ""en"", ""lc_src"": ""ja"", ""tier"": ""pro"" } ] "; var preferences = await group.GetPreferredTranslators(); Assert.IsNotNull(preferences); Assert.AreEqual(2, preferences.Length, "Lengths does not match"); Assert.AreEqual(new DateTime(2013, 7, 3), preferences[0].Translators[1].LastLogin.Date, "Login dates don't match"); Assert.AreEqual(TranslationTier.Standard, preferences[0].Tier, "First tier don't match"); Assert.AreEqual(TranslationTier.Pro, preferences[1].Tier, "Second tier don't match"); Assert.AreEqual(2, preferences[0].Translators[1].NumberOfJobs, "Number of jobs don't match"); Assert.AreEqual(3627, preferences[1].Translators[1].Id, "Translator Ids don't match"); }
public async Task TestGetAllMocked() { var mockedClient = new MockedGengoClient(); var group = new GlossaryMethodGroup(mockedClient); mockedClient.Json[GlossaryMethodGroup.UriPartGlossary] = @" [ { ""customer_user_id"": 50110, ""source_language_id"": 8, ""target_languages"": [ [ 14, ""ja"" ] ], ""id"": 115, ""is_public"": false, ""unit_count"": 2, ""description"": null, ""source_language_code"": ""en-US"", ""ctime"": ""2012-07-19 02:57:10.526565"", ""title"": ""1342666627_50110_en_ja_glossary.csv"", ""status"": 1 } ] "; var list = await group.GetAll(); Assert.AreEqual(1, list.Length, "Length does not match"); Assert.AreEqual(115, list[0].GlossaryId, "Ids don't match"); Assert.AreEqual(50110, list[0].CustomerUserId, "Customer Ids don't match"); Assert.AreEqual("1342666627_50110_en_ja_glossary.csv", list[0].Title, "Titles don't match"); var dt = list[0].CreatedTime; Assert.AreEqual(new DateTime(2012, 07, 19, 2, 57, 10), new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second), "Dates don't match"); }