Пример #1
0
 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 CalonAPI();
     var calonModel = new CalonModel
     {
         //id = Guid.NewGuid(),
         kode = 1,
         nama = "Tiffany Taylor"
     };
     var b = a.Set(calonModel);
     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(calonModel.id, c.id);
     Assert.AreEqual("Tiffany Taylor", c.nama);
 }
 public void ListTest()
 {
     var a = new CalonAPI();
     var b = a.List(new Guid("4105e8ef-29a1-5893-8103-cbd2c1e5fbaa"));
     Assert.AreEqual(3, b.response.count);
 }