static async Task<IEnumerable<CalonModel>> LoadData() { var pilkadaApi = new PilkadaAPI(); var eventModels = pilkadaApi.EventList().response.data.FirstOrDefault(); if ( eventModels == null) throw new Exception("Tidak ada Even Pilkada"); var calonApi = new CalonAPI(); await Task.Delay(100); return calonApi.List(eventModels.id).response.data; }
public void SetTest() { var a = new PilkadaAPI(); var pilkadaModel = new PilkadaModel { id = new Guid("115682e1-e390-50f0-ad72-feaf9afe425c"), jenis = 1, nama = "KAB. SUMEDANG" }; var b = a.Set(pilkadaModel); Assert.AreEqual(b.response.msg.ToLower(), "ok"); }
public void GetTest() { var a = new PilkadaAPI(); var id = new Guid("0cc744bf-b939-5e1e-ba1b-5f4013173ab8"); var b = a.Get(id); Assert.AreEqual(1, b.response.count); Assert.AreEqual(1, b.response.data.Count()); var c = b.response.data.ToList()[0]; Assert.AreNotEqual(null, c); Assert.AreEqual(id, c.id); Assert.AreEqual("KAB. KEDIRI", c.nama); }
public void ListTest() { var a = new PilkadaAPI(); var b = a.List(); Assert.AreEqual(12, b.response.count); }
static async Task<IEnumerable<PilkadaModel>> LoadData() { var pilkadaApi = new PilkadaAPI(); await Task.Delay(100); return pilkadaApi.List().response.data; }