ICalendarItem CreateCalendarItem(Post post) { try { string postUrl = _settings.BaseUrl; try { postUrl += post.Url; } // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { // HACK: In unit-testing scenarios, accessing URL causes database access. Well done, telligent! } var calendarItem = new CalendarItem { StartDate = post[_eventPluginConfigurationProvider.StartDateField].AsEventDate(), EndDate = post[_eventPluginConfigurationProvider.EndDateField].AsEventDate(), Location = post[_eventPluginConfigurationProvider.LocationUnknownField].IsSelected() ? _eventPluginConfigurationProvider.UnknownText : post[_eventPluginConfigurationProvider.LocationField], Subject = HttpUtility.HtmlDecode(post.Title), Description = postUrl, LastModified = post.Published, Categories = HttpUtility.HtmlDecode(_settings.Title) }; if (!calendarItem.IsValid()) { return(null); } return(calendarItem); } catch (Exception ex) { Logger.Error(Create.New.LogMessage().WithTitle("Could not create calendar item from post {0}", post.Id), ex); return(null); } }
ICalendarItem CreateCalendarItem(Post post) { try { string postUrl = _settings.BaseUrl; try { postUrl += post.Url; } // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { // HACK: In unit-testing scenarios, accessing URL causes database access. Well done, telligent! } var calendarItem = new CalendarItem { StartDate = post[_eventPluginConfigurationProvider.StartDateField].AsEventDate(), EndDate = post[_eventPluginConfigurationProvider.EndDateField].AsEventDate(), Location = post[_eventPluginConfigurationProvider.LocationUnknownField].IsSelected() ? _eventPluginConfigurationProvider.UnknownText : post[_eventPluginConfigurationProvider.LocationField], Subject = HttpUtility.HtmlDecode(post.Title), Description = postUrl, LastModified = post.Published, Categories = HttpUtility.HtmlDecode(_settings.Title) }; if (!calendarItem.IsValid()) { return null; } return calendarItem; } catch (Exception ex) { Logger.Error(Create.New.LogMessage().WithTitle("Could not create calendar item from post {0}", post.Id), ex); return null; } }