Esempio n. 1
0
        public void Encoding3()
        {
            var iCal = SimpleDeserializer.Default.Deserialize(new StringReader(IcsFiles.Encoding3)).Cast <Calendar>().Single();

            ProgramTest.TestCal(iCal);
            var evt = iCal.Events.First();

            Assert.AreEqual("uuid1153170430406", evt.Uid, "UID should be 'uuid1153170430406'; it is " + evt.Uid);
            Assert.AreEqual(1, evt.Sequence, "SEQUENCE should be 1; it is " + evt.Sequence);
        }
Esempio n. 2
0
        public void GeographicLocation1_2()
        {
            var iCal = SimpleDeserializer.Default.Deserialize(new StringReader(IcsFiles.GeographicLocation1)).Cast <Calendar>().Single();

            ProgramTest.TestCal(iCal);
            var evt = iCal.Events.First();

            Assert.AreEqual(37.386013, evt.GeographicLocation.Latitude, "Latitude should be 37.386013; it is not.");
            Assert.AreEqual(-122.082932, evt.GeographicLocation.Longitude, "Longitude should be -122.082932; it is not.");
        }
Esempio n. 3
0
        public void GeographicLocation1_2()
        {
            var iCal = Calendar.Load(IcsFiles.GeographicLocation1);

            ProgramTest.TestCal(iCal);
            var evt = iCal.Events.First();

            Assert.AreEqual(37.386013, evt.GeographicLocation.Latitude, "Latitude should be 37.386013; it is not.");
            Assert.AreEqual(-122.082932, evt.GeographicLocation.Longitude, "Longitude should be -122.082932; it is not.");
        }
Esempio n. 4
0
        public void Encoding3()
        {
            var iCal = Calendar.Load(IcsFiles.Encoding3);

            ProgramTest.TestCal(iCal);
            var evt = iCal.Events.First();

            Assert.AreEqual("uuid1153170430406", evt.Uid, "UID should be 'uuid1153170430406'; it is " + evt.Uid);
            Assert.AreEqual(1, evt.Sequence, "SEQUENCE should be 1; it is " + evt.Sequence);
        }
Esempio n. 5
0
        public void Journal1()
        {
            var iCal = Calendar.Load(IcsFiles.Journal1);

            ProgramTest.TestCal(iCal);
            Assert.AreEqual(1, iCal.Journals.Count);
            var j = iCal.Journals[0];

            Assert.IsNotNull(j, "Journal entry was null");
            Assert.AreEqual(JournalStatus.Draft, j.Status, "Journal entry should have been in DRAFT status, but it was in " + j.Status + " status.");
            Assert.AreEqual("PUBLIC", j.Class, "Journal class should have been PUBLIC, but was " + j.Class + ".");
            Assert.IsNull(j.Start);
        }
Esempio n. 6
0
        public void CompletedTodo_Tests(string calendarString, IList <KeyValuePair <CalDateTime, bool> > incoming)
        {
            var iCal = Calendar.Load(calendarString);

            ProgramTest.TestCal(iCal);
            var todo = iCal.Todos;

            foreach (var calDateTime in incoming)
            {
                var dt = calDateTime.Key;
                dt.TzId = _tzid;
                Assert.AreEqual(calDateTime.Value, todo[0].IsCompleted(dt));
            }
        }
Esempio n. 7
0
        public void TestAlarm(string calendarString, List <IDateTime> dates, CalDateTime start, CalDateTime end)
        {
            var iCal = Calendar.Load(calendarString);

            ProgramTest.TestCal(iCal);
            var evt = iCal.Events.First();

            // Poll all alarms that occurred between Start and End
            var alarms = evt.PollAlarms(start, end);

            var utcDates = new HashSet <DateTime>(dates.Select(d => d.AsUtc));

            //Only compare the UTC values here, since we care about the time coordinate when the alarm fires, and nothing else
            foreach (var alarm in alarms.Select(a => a.DateTime.AsUtc))
            {
                Assert.IsTrue(utcDates.Contains(alarm), "Alarm triggers at " + alarm + ", but it should not.");
            }
            Assert.IsTrue(dates.Count == alarms.Count, "There were " + alarms.Count + " alarm occurrences; there should have been " + dates.Count + ".");
        }
Esempio n. 8
0
        public void Encoding2()
        {
            var iCal = SimpleDeserializer.Default.Deserialize(new StringReader(IcsFiles.Encoding2)).Cast <Calendar>().Single();

            ProgramTest.TestCal(iCal);
            var evt = iCal.Events.First();

            Assert.AreEqual(
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.",
                evt.Attachments[0].ToString(),
                "Attached value does not match.");
        }
Esempio n. 9
0
        public void Encoding2()
        {
            var iCal = Calendar.Load(IcsFiles.Encoding2);

            ProgramTest.TestCal(iCal);
            var evt = iCal.Events.First();

            Assert.AreEqual(
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.\r\n" +
                "This is a test to try out base64 encoding without being too large.",
                evt.Attachments[0].ToString(),
                "Attached value does not match.");
        }