public async Task <bool> SetPerkPage(PerkPage page) { HttpContent content = new StringContent(page.ToJson()); var res = await m_client.PutAsync(GetPluginUrl("/v1/pages/" + page.Id), content); return(res.IsSuccessStatusCode); }
public async Task SetPerkPage() { List <PerkPage> pages = await client.Perks.GetPerkPages(); PerkPage page = pages.FirstOrDefault(x => x.IsEditable); if (page == null) { Assert.Inconclusive("No editable page available to test"); } else { string oldName = page.Name; page.Name = "Test name"; bool success = await client.Perks.SetPerkPage(page); Assert.IsTrue(success); page.Name = oldName; await Task.Delay(1000); // Client might be slow, so give it time to catch up. Maybe not needed. success = await client.Perks.SetPerkPage(page); Assert.IsTrue(success); } }