public void Attendees_DifferentFormats() { // Arrange const string EMAIL_ATTENDEE_1 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_2 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_3 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_4 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_5 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_6 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_7 = "mailto:[email protected]"; // Act var cleanedIcal = IcalCleaner.CleanVCalFile(IcsFiles.Cleaner_Attendees2); // Assert var calendar = Calendar.Load(cleanedIcal); var attendees = calendar.Events[0].Attendees; var attendee1 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_1); var attendee2 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_2); var attendee3 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_3); var attendee4 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_4); var attendee5 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_5); var attendee6 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_6); var attendee7 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_7); Assert.AreEqual(7, attendees.Count); Assert.AreEqual(EMAIL_ATTENDEE_1, attendee1.Value.ToString()); Assert.AreEqual("HPO Test ([email protected])", attendee1.CommonName); Assert.IsTrue(attendee1.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_2, attendee2.Value.ToString()); Assert.AreEqual("HPO Test ([email protected]) with many semicolons", attendee2.CommonName); Assert.AreEqual(ParticipationRole.RequiredParticipant, attendee2.Role); Assert.AreEqual(EventParticipationStatus.NeedsAction, attendee2.ParticipationStatus); Assert.IsTrue(attendee2.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_3, attendee3.Value.ToString()); Assert.AreEqual("HPO Test ([email protected]) ([email protected])", attendee3.CommonName); Assert.AreEqual(ParticipationRole.RequiredParticipant, attendee3.Role); Assert.AreEqual(EventParticipationStatus.NeedsAction, attendee3.ParticipationStatus); Assert.IsTrue(attendee3.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_4, attendee4.Value.ToString()); Assert.AreEqual("HPO Test ([email protected]) without RSVP", attendee4.CommonName); Assert.IsFalse(attendee4.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_5, attendee5.Value.ToString()); Assert.AreEqual("Eike Müller ([email protected]). attendee with line break with tab. first line contains an email address.", attendee5.CommonName); Assert.IsTrue(attendee5.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_6, attendee6.Value.ToString()); Assert.AreEqual("Madeline Kraus. attendee with line break with tab. first line does not contain an email address.", attendee6.CommonName); Assert.IsTrue(attendee6.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_7, attendee7.Value.ToString()); Assert.AreEqual("HPO Test ([email protected]) does not have a mailto", attendee7.CommonName); Assert.IsTrue(attendee7.Rsvp); }
public void NormalText_LineBreakTests() { // Act var cleanedIcal = IcalCleaner.CleanVCalFile(IcsFiles.Cleaner_NormalTextLineBreaks); // Assert var calendar = Calendar.Load(cleanedIcal); Assert.That(calendar.Events.Select(x => x.Description), Is.All.EqualTo("This is one line!")); }
public void QuotedPrintable_UmlauteAndSpecialCharacters() { // Act var cleanedIcal = IcalCleaner.CleanVCalFile(IcsFiles.Cleaner_QuotedPrintable_UmlauteAndSpecialCharacters); // Assert var calendar = Calendar.Load(cleanedIcal); Assert.AreEqual(calendar.Events[0].Description, "öÖüÜäÄ–"); }
public void QuotedPrintable3() { // Assert var cleanedIcal = IcalCleaner.CleanVCalFile(IcsFiles.Cleaner_QuotedPrintable3); // Act var ex = Assert.Throws <SerializationException>(() => Calendar.Load(cleanedIcal)); // Assert Assert.That(ex.Message, Is.EqualTo("Could not parse line: '....................=0D=0A=0D=0A =0D=0A=0D=0A'")); }
public void QuotedPrintable2() { // Act var cleanedIcal = IcalCleaner.CleanVCalFile(IcsFiles.Cleaner_QuotedPrintable2); // Assert var calendar = Calendar.Load(cleanedIcal); Assert.NotNull(calendar.Events[0].Description); Assert.IsNotEmpty(calendar.Events[0].Description); }
public void Attendees_SpecialCaseIcal() { // Act var cleanedIcal = IcalCleaner.CleanVCalFile(IcsFiles.Cleaner_Attendees1); // Assert var calendar = Calendar.Load(cleanedIcal); var attendees = calendar.Events[0].Attendees; Assert.AreEqual(17, attendees.Count); Assert.That(attendees.Select(x => x.Role), Is.All.EqualTo(ParticipationRole.RequiredParticipant)); Assert.That(attendees.Select(x => x.ParticipationStatus), Is.All.EqualTo(EventParticipationStatus.NeedsAction)); Assert.That(attendees.Select(x => x.Rsvp), Is.All.EqualTo(true)); Assert.Contains("Johann Lintner GKK Dirketor ", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("Petra Einspieler-Aman ([email protected])", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("STADTSCHREIBER Gerhard", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("STICKLER Gernot", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("ASTNER Robert", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("MICHELER-EISNER Ulrike", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); Assert.Contains("'*****@*****.**'", attendees.Select(x => x.CommonName).ToList()); Assert.Contains("mailto:[email protected]", attendees.Select(x => x.Value.ToString()).ToList()); }
public void Attendees_RFC() { // Arrange const string EMAIL_ATTENDEE_1 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_2 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_3 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_4 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_5 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_6 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_7 = "mailto:[email protected]"; const string EMAIL_ATTENDEE_8 = "mailto:[email protected]"; //const string EMAIL_ATTENDEE_9 = "mailto:[email protected]"; // Act var cleanedIcal = IcalCleaner.CleanVCalFile(IcsFiles.Cleaner_Attendees3); // Assert var calendar = Calendar.Load(cleanedIcal); var attendees = calendar.Events[0].Attendees; var attendee1 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_1); // Contains: MEMBER var attendee2 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_2); // Contains: DELEGATED-FROM var attendee3 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_3); var attendee4 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_4); var attendee5 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_5); // Contains: DIR var attendee6 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_6); // Contains: DELEGATED-FROM var attendee7 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_7); // Contains: DELEGATED-TO var attendee8 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_8); // Contains: DELEGATED-FROM //var attendee9 = attendees.First(x => x.Value.ToString() == EMAIL_ATTENDEE_9); //senty-by Assert.AreEqual(8, attendees.Count); Assert.AreEqual(EMAIL_ATTENDEE_1, attendee1.Value.ToString()); Assert.Contains("mailto:[email protected]", attendee1.Members.ToList()); Assert.IsFalse(attendee1.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_2, attendee2.Value.ToString()); Assert.Contains("mailto:[email protected]", attendee2.DelegatedFrom.ToList()); Assert.IsFalse(attendee2.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_3, attendee3.Value.ToString()); Assert.AreEqual("Henry Cabot", attendee3.CommonName); Assert.AreEqual(ParticipationRole.RequiredParticipant, attendee3.Role); Assert.AreEqual(EventParticipationStatus.Tentative, attendee3.ParticipationStatus); Assert.IsFalse(attendee3.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_4, attendee4.Value.ToString()); Assert.AreEqual("Jane Doe", attendee4.CommonName); Assert.Contains("mailto:[email protected]", attendee4.DelegatedFrom.ToList()); Assert.AreEqual(ParticipationRole.RequiredParticipant, attendee4.Role); Assert.AreEqual(EventParticipationStatus.Accepted, attendee4.ParticipationStatus); Assert.IsFalse(attendee4.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_5, attendee5.Value.ToString()); Assert.AreEqual("John Smith", attendee5.CommonName); Assert.AreEqual("ldap://example.com:6666/o=ABC%20Industries,c=US???(cn=Jim%20Dolittle)", attendee5.Parameters.Get("DIR")); Assert.IsFalse(attendee5.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_6, attendee6.Value.ToString()); Assert.AreEqual("Henry Cabot", attendee6.CommonName); Assert.AreEqual(ParticipationRole.RequiredParticipant, attendee6.Role); Assert.AreEqual(EventParticipationStatus.Tentative, attendee6.ParticipationStatus); Assert.Contains("mailto:[email protected]", attendee6.DelegatedFrom.ToList()); Assert.IsFalse(attendee6.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_7, attendee7.Value.ToString()); Assert.AreEqual("The Big Cheese", attendee7.CommonName); Assert.AreEqual(ParticipationRole.NonParticipant, attendee7.Role); Assert.AreEqual(EventParticipationStatus.Delegated, attendee7.ParticipationStatus); Assert.Contains("mailto:[email protected]", attendee7.DelegatedTo.ToList()); Assert.IsFalse(attendee7.Rsvp); Assert.AreEqual(EMAIL_ATTENDEE_8, attendee8.Value.ToString()); Assert.AreEqual("Jane Doe", attendee8.CommonName); Assert.AreEqual(ParticipationRole.RequiredParticipant, attendee8.Role); Assert.AreEqual(EventParticipationStatus.Accepted, attendee8.ParticipationStatus); Assert.IsFalse(attendee8.Rsvp); }