public iAppointment(vEvent vevent) { Subject = vevent.GetContentLineValueOrDefault("SUMMARY"); Details = vevent.GetContentLineValueOrDefault("DESCRITON"); StartTime = new iDateTime(vevent.GetContentLine("DTSTART")); EndTime = new iDateTime(vevent.GetContentLine("DTEND")); Location = vevent.GetContentLineValueOrDefault("LOCATION"); AllDay = vevent.GetContentLine("DTSTART").HasParameterAndValue("VALUE", "DATE"); }
public void TestvEvent() { string input = @"DTSTART;TZID=America/New_York:20150325T113000 DTEND;TZID=America/New_York:20150325T123000 SUMMARY:GoToWebinar - TMS 2014: Media Metadata Writing & Injection LOCATION:GoToWebinar - See conference call information below"; vEvent vevent = new vEvent(input); Assert.IsTrue(vevent.ContentLines.Count == 4); Assert.IsTrue(vevent.ContentLines[0].Name.Equals("DTSTART")); Assert.IsTrue(vevent.ContentLines[0].Value.Equals("20150325T113000")); Assert.IsTrue(vevent.ContentLines[0].Parameters.Count == 1); Assert.IsTrue(vevent.ContentLines[0].Parameters.ContainsKey("TZID")); Assert.IsTrue(vevent.ContentLines[0].Parameters["TZID"].Count == 1); Assert.IsTrue(vevent.ContentLines[0].Parameters["TZID"][0].Equals("America/New_York")); Assert.IsTrue(vevent.ContentLines[1].Name.Equals("DTEND")); Assert.IsTrue(vevent.ContentLines[1].Value.Equals("20150325T123000")); Assert.IsTrue(vevent.ContentLines[1].Parameters.Count == 1); Assert.IsTrue(vevent.ContentLines[1].Parameters.ContainsKey("TZID")); Assert.IsTrue(vevent.ContentLines[1].Parameters["TZID"].Count == 1); Assert.IsTrue(vevent.ContentLines[1].Parameters["TZID"][0].Equals("America/New_York")); Assert.IsTrue(vevent.ContentLines[2].Name.Equals("SUMMARY")); Assert.IsTrue(vevent.ContentLines[2].Value.Equals("GoToWebinar - TMS 2014: Media Metadata Writing & Injection")); Assert.IsTrue(vevent.ContentLines[2].Parameters.Count == 0); Assert.IsTrue(vevent.ContentLines[3].Name.Equals("LOCATION")); Assert.IsTrue(vevent.ContentLines[3].Value.Equals("GoToWebinar - See conference call information below")); Assert.IsTrue(vevent.ContentLines[3].Parameters.Count == 0); }