Ejemplo n.º 1
0
        public void SERIALIZE24()
        {
            //
            // Ensures that custom iCalendars are loaded correctly
            //
            iCalendar   calendar   = iCalendar.LoadFromFile <iCalendar>(@"Calendars\Serialization\SERIALIZE1.ics");
            CustomICal1 customiCal = iCalendar.LoadFromFile <CustomICal1>(@"Calendars\Serialization\SERIALIZE1.ics");

            Assert.IsTrue(calendar.Events.Count == 1, "Calendar should have 1 event");
            Assert.IsTrue(customiCal.Events.Count == 1, "Custom calendar should have 1 event");
            Assert.IsTrue(calendar.Events[0].GetType() == typeof(Event), "Calendar event should be of type Event");
            Assert.IsTrue(customiCal.Events[0].GetType() == typeof(CustomEvent1), "Custom calendar event should be of type CustomEvent1");
        }
Ejemplo n.º 2
0
        public void SERIALIZE16()
        {
            CustomICal1 iCal            = new CustomICal1();
            string      nonstandardText = "Some nonstandard property we want to serialize";

            CustomEvent1 evt = (CustomEvent1)Event.Create(iCal);

            evt.Summary             = "Test event";
            evt.Start               = new DateTime(2007, 02, 15);
            evt.NonstandardProperty = nonstandardText;
            evt.IsAllDay            = true;

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);

            serializer.Serialize(@"Calendars\Serialization\SERIALIZE16.ics");

            iCal = (CustomICal1)iCalendar.LoadFromFile(typeof(CustomICal1), @"Calendars\Serialization\SERIALIZE16.ics");
            foreach (CustomEvent1 evt1 in iCal.Events)
            {
                Assert.IsTrue(evt1.NonstandardProperty.Equals(nonstandardText));
            }

            SerializeTest("SERIALIZE16.ics");
        }
Ejemplo n.º 3
0
        public void SERIALIZE16()
        {
            CustomICal1 iCal = new CustomICal1();
            string nonstandardText = "Some nonstandard property we want to serialize";

            CustomEvent1 evt = iCal.Create<CustomEvent1>();
            evt.Summary = "Test event";
            evt.Start = new DateTime(2007, 02, 15);
            evt.NonstandardProperty = nonstandardText;
            evt.IsAllDay = true;

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"Calendars\Serialization\SERIALIZE16.ics");

            iCal = iCalendar.LoadFromFile<CustomICal1>(@"Calendars\Serialization\SERIALIZE16.ics");
            foreach (CustomEvent1 evt1 in iCal.Events)
                Assert.IsTrue(evt1.NonstandardProperty.Equals(nonstandardText));

            SerializeTest("SERIALIZE16.ics", typeof(CustomICal1));
        }