コード例 #1
0
        private void CheckEvent(string eventData, AppointmentId appointmentId, int[] expectedSequenceNumbers)
        {
            var calendar = OutlookTestContext.DeserializeICalendar(eventData);

            Assert.That(calendar.Events.Count, Is.EqualTo(3));

            var masterEvent    = calendar.Events.Single(e => e.Summary == "Treffen");
            var exeption1Event = calendar.Events.Single(e => e.Summary == "Ex 1");
            var exeption2Event = calendar.Events.Single(e => e.Summary == "Ex 2");

            CollectionAssert.AreEquivalent(expectedSequenceNumbers, calendar.Events.Select(e => e.Sequence));
            Assert.That(exeption1Event.UID, Is.EqualTo(masterEvent.UID));
            Assert.That(exeption2Event.UID, Is.EqualTo(masterEvent.UID));

            using (var masterAppointment = OutlookTestContext.GetOutlookEvent(appointmentId))
            {
                GenericComObjectWrapper <AppointmentItem> exeption1Appointment;
                GenericComObjectWrapper <AppointmentItem> exeption2Appointment;

                using (var r = GenericComObjectWrapper.Create(masterAppointment.Inner.GetRecurrencePattern()))
                {
                    exeption1Appointment = GenericComObjectWrapper.Create(r.Inner.Exceptions[1].AppointmentItem);
                    exeption2Appointment = GenericComObjectWrapper.Create(r.Inner.Exceptions[2].AppointmentItem);
                }

                Assert.That(masterEvent.Start.Value, Is.EqualTo(masterAppointment.Inner.Start));
                Assert.That(exeption1Event.Start.Value, Is.EqualTo(exeption1Appointment.Inner.Start));
                Assert.That(exeption2Event.Start.Value, Is.EqualTo(exeption2Appointment.Inner.Start));
            }
        }
コード例 #2
0
        private async void ImportIcsData_Click(object sender, RibbonControlEventArgs e)
        {
            try
            {
                EnsureSynchronizationContext();

                var dataInputWindow = CreateWindowWithTextBox();
                dataInputWindow.Item1.ShowDialog();

                var entitySynchronizationLogger = new EntitySynchronizationLogger();

                await OutlookTestContext.EventRepository.Create(
                    async appointmentWrapper => await OutlookTestContext.EntityMapper.Map2To1(
                        OutlookTestContext.DeserializeICalendar(dataInputWindow.Item2.Text),
                        appointmentWrapper,
                        entitySynchronizationLogger),
                    NullEventSynchronizationContext.Instance);

                var reportWindow = CreateWindowWithTextBox();
                reportWindow.Item2.Text = "SynchronizationReport:\r\n" + Serializer <EntitySynchronizationReport> .Serialize(entitySynchronizationLogger.GetReport());

                reportWindow.Item1.ShowDialog();
            }
            catch (Exception x)
            {
                ExceptionHandler.Instance.DisplayException(x, s_logger);
            }
        }
コード例 #3
0
        public void TestTimeRangeFilter()
        {
            OutlookTestContext.DeleteAllOutlookEvents();

            OutlookTestContext.CreateEventInOutlook("before", DateTime.Now.AddDays(-20), DateTime.Now.AddDays(-11));
            OutlookTestContext.CreateEventInOutlook("after", DateTime.Now.AddDays(11), DateTime.Now.AddDays(20));
            OutlookTestContext.CreateEventInOutlook("overlapBeginning", DateTime.Now.AddDays(-11), DateTime.Now.AddDays(-9));
            OutlookTestContext.CreateEventInOutlook("overlapEnd", DateTime.Now.AddDays(9), DateTime.Now.AddDays(11));
            OutlookTestContext.CreateEventInOutlook("inside", DateTime.Now.AddDays(-5), DateTime.Now.AddDays(5));
            OutlookTestContext.CreateEventInOutlook("surrounding", DateTime.Now.AddDays(-11), DateTime.Now.AddDays(11));

            var eventDatas = OutlookTestContext.SyncOutlookToCalDav_CalDavIsEmpty(
                null,
                o =>
            {
                o.DaysToSynchronizeInTheFuture   = 10;
                o.DaysToSynchronizeInThePast     = 10;
                o.IgnoreSynchronizationTimeRange = false;
            });

            var calendars = eventDatas.Select(OutlookTestContext.DeserializeICalendar).ToArray();

            Assert.That(calendars.Length, Is.EqualTo(4));

            CollectionAssert.AreEquivalent(
                new[]
            {
                "overlapBeginning", "overlapEnd", "inside", "surrounding"
            },
                calendars.Select(c => c.Events[0].Summary));
        }
コード例 #4
0
        public void ExistsInCalDav()
        {
            OutlookTestContext.DeleteAllOutlookEvents();

            var appointmentId = OutlookTestContext.CreateRecurringEventInOutlook();

            var eventData = OutlookTestContext.SyncOutlookToCalDav_EventsExistsInCalDav(s_existingEvent, appointmentId);

            CheckEvent(eventData, appointmentId, new[] { 2, 3, 4 });
        }
コード例 #5
0
        public void CreateNewInCalDav()
        {
            OutlookTestContext.DeleteAllOutlookEvents();

            var appointmentId = OutlookTestContext.CreateRecurringEventInOutlook();

            var eventData = OutlookTestContext.SyncOutlookToCalDav_CalDavIsEmpty();

            CheckEvent(eventData[0], appointmentId, new[] { 0, 1, 2 });
        }
コード例 #6
0
        private void StartTestsButton_Click(object sender, RibbonControlEventArgs e)
        {
            var display = new TestResultDisplay();

            display.Show();
            var runner = new TestRunner(display);

            ManualAssert.Initialize(display);
            OutlookTestContext.Initialize(Globals.ThisAddIn.Application.Session);
            runner.Run(Assembly.GetExecutingAssembly());
        }
コード例 #7
0
        private static void StartTests(bool excludeManual)
        {
            EnsureSynchronizationContext();
            var display = new TestResultDisplay();

            display.Show();
            var runner = new TestRunner(display);

            ManualAssert.Initialize(display);
            OutlookTestContext.Initialize(Globals.ThisAddIn.Application.Session);
            runner.Run(Assembly.GetExecutingAssembly(), excludeManual);
        }
コード例 #8
0
        public void FindsMatchingEntites()
        {
            OutlookTestContext.DeleteAllOutlookEvents();

            var id1 = OutlookTestContext.CreateEventInOutlook("first", DateTime.Now.AddDays(11), DateTime.Now.AddDays(20));
            var id2 = OutlookTestContext.CreateEventInOutlook("second", DateTime.Now.AddDays(-11), DateTime.Now.AddDays(-9));
            var id3 = OutlookTestContext.CreateEventInOutlook("third", DateTime.Now.AddDays(9), DateTime.Now.AddDays(11));

            var entityRelationStorage = new InMemoryEntityRelationStorage();
            var calDavServer          = new InMemoryCalDAVServer();

            var synchronizer = OutlookTestContext.CreateEventSynchronizer(
                SynchronizationMode.ReplicateOutlookIntoServer,
                calDavServer,
                entityRelationStorage);


            OutlookTestContext.WaitForTask(synchronizer.Synchronize(NullSynchronizationLogger.Instance));

            var entityRelationDatas = entityRelationStorage.LoadEntityRelationData().ToArray();

            Assert.That(entityRelationDatas.Length, Is.EqualTo(3));

            var newEntityRelationStorage = new InMemoryEntityRelationStorage();

            synchronizer = OutlookTestContext.CreateEventSynchronizer(
                SynchronizationMode.MergeInBothDirections,
                calDavServer,
                newEntityRelationStorage);

            OutlookTestContext.WaitForTask(synchronizer.Synchronize(NullSynchronizationLogger.Instance));

            var newRelations = newEntityRelationStorage.LoadEntityRelationData().ToArray();

            // If the InitialEntityMatcher would not work, it would not recognize matching events
            // and number of events would be doubled, since each repository contains 3 events and mode is MergeInBothDirections
            Assert.That(newRelations.Length, Is.EqualTo(3));

            // the new found relkations must be the same as the existing ones
            foreach (var newRelation in newRelations)
            {
                Assert.That(
                    entityRelationDatas.FirstOrDefault(o => o.AtypeId == newRelation.AtypeId &&
                                                       o.AtypeVersion == newRelation.AtypeVersion &&
                                                       o.BtypeId == newRelation.BtypeId &&
                                                       o.BtypeVersion == newRelation.BtypeVersion),
                    Is.Not.Null);
            }
        }
コード例 #9
0
        public void KeepsUid()
        {
            var eventData = @"
BEGIN:VCALENDAR
PRODID:-//Inverse inc./SOGo 2.2.16//EN
VERSION:2.0
BEGIN:VEVENT
UID:59E2-55170300-17-5DFC2102
SUMMARY:testmeeting
DTSTART;TZID=Europe/Vienna:20150429T110000
DTEND;TZID=Europe/Vienna:20150429T123000
X-CALDAVSYNCHRONIZER-TEST:This is a test property
END:VEVENT
END:VCALENDAR
      ";

            var roundTrippedData = OutlookTestContext.SyncCalDavToOutlookAndBackToCalDav(eventData);

            Assert.That(roundTrippedData, Does.Contain("UID:59E2-55170300-17-5DFC2102"));
        }
コード例 #10
0
 private void TestAutomationRibbon_Load(object sender, RibbonUIEventArgs e)
 {
     OutlookTestContext.Initialize(Globals.ThisAddIn.Application.Session);
 }
コード例 #11
0
        public void TestOrganizerRoundTrip()
        {
            var eventData = @"
BEGIN:VCALENDAR
PRODID:-//Inverse inc./SOGo 2.2.16//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Europe/Vienna
X-LIC-LOCATION:Europe/Vienna
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:59E2-55170300-17-5DFC2102
SUMMARY:testmeeting
LOCATION:daheim
DESCRIPTION:important meeting 1
CLASS:PUBLIC
PRIORITY:1
CREATED:20150328T194007Z
DTSTAMP:20150328T194007Z
LAST-MODIFIED:20150328T194140Z
DTSTART;TZID=Europe/Vienna:20150429T110000
DTEND;TZID=Europe/Vienna:20150429T123000
TRANSP:OPAQUE
X-SOGO-SEND-APPOINTMENT-NOTIFICATIONS:NO
ORGANIZER;CN=Test Account:mailto:[email protected]
ATTENDEE;PARTSTAT=ACCEPTED;ROLE=REQ-PARTICIPANT;CN=Alexander Nimmervoll:mailto:[email protected]
ATTENDEE;PARTSTAT=TENTATIVE;ROLE=REQ-PARTICIPANT;CN=Testaccount OBS2009:mailto:[email protected]
END:VEVENT
END:VCALENDAR
      ";

            var evt = OutlookTestContext.DeserializeICalendar(eventData);

            using (var outlookEvent = OutlookTestContext.CreateNewAppointment())
            {
                OutlookTestContext.EntityMapper.Map2To1(evt, outlookEvent);

                _Inspector inspector = outlookEvent.Inner.GetInspector;

                inspector.Activate();

                ManualAssert.Assert("Check if the Organizer of the Meeting is Equal to: 'Test Account <*****@*****.**>'");

                inspector.Close(OlInspectorClose.olDiscard);

                var newCalendar = OutlookTestContext.EntityMapper.Map1To2(outlookEvent, new iCalendar());

                Assert.That(newCalendar.Events[0].Organizer.CommonName, Is.EqualTo("Test Account"));
                Assert.That(newCalendar.Events[0].Organizer.Value.ToString(), Is.EqualTo("mailto:[email protected]"));

                outlookEvent.Inner.Delete();
            }
        }