Exemplo n.º 1
0
        public void EndsOnIsDateTimeOrDuration()
        {
            var start = new DateTimeOffset(1998, 04, 15, 13, 30, 00, TimeSpan.Zero);
            var end =   new DateTimeOffset(1998, 04, 15, 17, 00, 00, TimeSpan.Zero);

            var slot = new TimeSlot(new ContentLine("FREEBUSY:19980415T133000Z/19980415T170000Z"));
            Assert.AreEqual(1, slot.TimeRanges.Count);
            Assert.AreEqual(start, slot.TimeRanges[0].StartsOn);
            Assert.AreEqual(end, slot.TimeRanges[0].EndsOn);

            slot = new TimeSlot(new ContentLine("FREEBUSY:19980415T133000Z/PT3H30M"));
            Assert.AreEqual(1, slot.TimeRanges.Count);
            Assert.AreEqual(start, slot.TimeRanges[0].StartsOn);
            Assert.AreEqual(end, slot.TimeRanges[0].EndsOn);
        }
Exemplo n.º 2
0
        public void UsageFromContentLine()
        {
            var slot = new TimeSlot(new ContentLine("FREEBUSY;FBTYPE=BUSY:19980415T133000Z/19980415T170000Z"));
            Assert.AreEqual(TimeUsage.Busy, slot.Usage);

            slot = new TimeSlot(new ContentLine("FREEBUSY;FBTYPE=BUSY-tentative:19980415T133000Z/19980415T170000Z"));
            Assert.AreEqual(TimeUsage.Tentative, slot.Usage);

            slot = new TimeSlot(new ContentLine("FREEBUSY:19980415T133000Z/19980415T170000Z"));
            Assert.AreEqual(TimeUsage.Busy, slot.Usage);
        }
Exemplo n.º 3
0
        TimeSlot WriteRead(string ics)
        {
            var slot = new TimeSlot(new ContentLine(ics));
            var s = new StringWriter();
            slot.WriteIcs(IcsWriter.Create(s));

            return new TimeSlot(new ContentLine(s.ToString()));
        }