public bool deserialize(JObject pObject) { SerialHelper serial = new SerialHelper(); bool estado = true; dynamic json = pObject; try { this.Id = (int)json.id; this.Nombre = (string)json.name; this.Ubicacion = (string)json.ubication; this.Pais = (string)json.country; this.FechaInicioFestival = serial.parseFecha(json.initial_date); this.FechaFinalFestival = serial.parseFecha(json.final_date); this.FechaFinalVotacion = serial.parseFecha(json.vote_final_date); this.TipoEvento = (string)json.event_type; this.Estado = (string)json.state; } catch (Exception e) { estado = false; throw (e); } return(estado); }
public void parseFechaTest() { /* Arrange */ string ff = "1995-09-18T06:00:00.000Z"; /* Act */ DateTime _date = _help.parseFecha(ff); /* Assert */ Assert.AreEqual(_date.Month, 09); Assert.AreEqual(_date.Year, 1995); }