public void GetPropertyParser_DateAlignmentIsSent_EnumPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.DateAlignment)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <EnumPropertyParser>(); }
public void GetPropertyParser_DragOpacityIsSent_FloatPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.DragOpacity)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <FloatPropertyParser>(); }
public void GetPropertyParser_SlotLabelIntervalIsSent_TimeSpanPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.SlotLabelInterval)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <TimeSpanPropertyParser>(); }
public void GetPropertyParser_BootstrapGlyphiconsIconsIsSent_ButtonIconsPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.BootstrapGlyphicons)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <ButtonIconsPropertyParser>(); }
public void GetPropertyParser_SelectLongPressDelayIsSent_IntegerPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.SelectLongPressDelay)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <IntegerPropertyParser>(); }
public void GetPropertyParser_DayPopoverFormatIsSent_FunctionPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.DayPopoverFormat)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <StringPropertyParser>(); }
public void GetPropertyParser_SelectConstraintIsSent_ObjectPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.SelectConstraint)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <ObjectPropertyParser>(); }
public void GetPropertyParser_EventDurationEditableIsSent_BoolPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.EventDurationEditable)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <BoolPropertyParser>(); }
public void GetPropertyParser_EventOrderIsSent_ArrayPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.EventOrder)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <ArrayPropertyParser>(); }
public void GetPropertyParser_DefaultAllDayEventDurationIsSent_TimeSpanPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.DefaultAllDayEventDuration)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <TimeSpanPropertyParser>(); }
public void GetPropertyParser_DragRevertDurationIsSent_IntegerPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.DragRevertDuration)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <IntegerPropertyParser>(); }
public void GetPropertyParser_HandleWindowResizeIsSent_DoublePropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.HandleWindowResize)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <BoolPropertyParser>(); }
public void GetPropertyParser_ViewsIsSent_CustomViewPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.Views)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <CustomViewPropertyParser>(); }
public void GetPropertyParser_ContentHeightIsSent_UnitPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.ContentHeight)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <UnitPropertyParser>(); }
public void GetPropertyParser_AspectRatioIsSent_DoublePropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.AspectRatio)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <DoublePropertyParser>(); }
public void GetPropertyParser_BusinessHoursIsSent_BusinessHoursPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.BusinessHours)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <BusinessHoursPropertyParser>(); }
public void GetPropertyParser_WeekNumberCalculationIsSent_FunctionPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.WeekNumberCalculation)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <FunctionPropertyParser>(); }
public void GetPropertyParser_FirstDayIsSent_DayOfWeekPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.FirstDay)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <DayOfWeekPropertyParser>(); }
public void GetPropertyParser_TimezoneParamIsSent_StringPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.TimezoneParam)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <StringPropertyParser>(); }
public void GetPropertyParser_NextDayThresholdIsSent_TimeSpanPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.NextDayThreshold)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <TimeSpanPropertyParser>(); }
public void GetPropertyParser_LazyFetchingIsSent_BoolPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.LazyFetching)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <BoolPropertyParser>(); }
public void GetPropertyParser_DefaultDateIsSent_DateTimePropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.DefaultDate)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <DateTimePropertyParser>(); }
public void GetPropertyParser_ColumnHeaderHtmlIsSent_FunctionPropertyParserIsCreated() { PropertyInfo property = typeof(FullCalendarParameters).GetProperties().Single(x => x.Name == nameof(FullCalendarParameters.ColumnHeaderHtml)); IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.Should().BeOfType <FunctionPropertyParser>(); }
static ParseResult <IPropertyValue> Parse <T>(IPropertyParser propertyParserUntyped, string textValue) { var propertyParserTyped = (IPropertyParser <T>)propertyParserUntyped; return(propertyParserTyped .ValueParser .Parse(textValue) .Map(value => (IPropertyValue) new PropertyValue <T>(propertyParserTyped.TargetProperty, value, ValueSource.Defined))); }
public static Option <IPropertyValue> Parse <T>(IPropertyParser propertyParserUntyped, string textValue) { var propertyParser = (IPropertyParser <T>)propertyParserUntyped; return(propertyParser .ValueParser .Parse(textValue) .Map(value => (IPropertyValue) new PropertyValue <T>(propertyParser.TargetProperty, value, ValueSource.Defined))); }
public IEnumerable <ILinkedEntity> GetLinkedEntities(object propertyValue) { if (propertyValue == null) { return(Enumerable.Empty <ILinkedEntity>()); } var entities = new List <ILinkedEntity>(); var contentTypes = new Dictionary <string, IContentType>(); var dataTypes = new Dictionary <int, IDataTypeDefinition>(); try { var items = JsonConvert.DeserializeObject <EmbeddedContentItem[]>(propertyValue.ToString()); foreach (EmbeddedContentItem item in items) { if (false == contentTypes.TryGetValue(item.ContentTypeAlias, out IContentType contentType)) { contentTypes[item.ContentTypeAlias] = contentType = _contentTypeService.GetContentType(item.ContentTypeAlias); } if (contentType == null) { continue; } foreach (PropertyType propertyType in contentType.PropertyTypes) { if (false == item.Properties.TryGetValue(propertyType.Alias, out object value)) { continue; } if (false == dataTypes.TryGetValue(propertyType.DataTypeDefinitionId, out IDataTypeDefinition dataTypeDefinition)) { dataTypes[propertyType.DataTypeDefinitionId] = dataTypeDefinition = _dataTypeService.GetDataTypeDefinitionById(propertyType.DataTypeDefinitionId); } if (dataTypeDefinition == null) { continue; } IPropertyParser parser = PropertyParserResolver.Current.Parsers.FirstOrDefault(x => x.IsParserFor(dataTypeDefinition)); if (parser != null) { entities.AddRange(parser.GetLinkedEntities(value)); } } } } catch (Exception exception) { _logger.Error <EmbeddedContentParser>("Error parsing embedded content", exception); } return(entities); }
public static Option <IPropertyValue> GetDefaultValue <T>(this IPropertyParser propertyParserUntyped) { IPropertyParser <T> propertyParser = (IPropertyParser <T>)propertyParserUntyped; if (propertyParser.DefaultValue != null) { var defaultValue = propertyParser.DefaultValue(); return(new PropertyValue <T>(propertyParser.TargetProperty, defaultValue, ValueSource.DefaultValue)); } return(None); }
internal IDictionary <string, object> Extract(IEventRecord record) { var dict = new Dictionary <string, object>(); dict.Add("EtwEventId", record.Id); dict.Add("Etw" + nameof(record.Timestamp), record.Timestamp); dict.Add("Etw" + nameof(record.ProcessId), record.ProcessId); dict.Add("Etw" + nameof(record.ThreadId), record.ThreadId); dict.Add("Etw" + nameof(record.ProviderName), record.ProviderName); if (_includeVerboseProperties) { dict.Add("EtwEventName", record.Name); dict.Add("Etw" + nameof(record.ProviderId), record.ProviderId); dict.Add("Etw" + nameof(record.Version), record.Version); dict.Add("Etw" + nameof(record.Level), record.Level); } IPropertyParser parser = null; if (providerDictionary.Contains(record.ProviderId)) { parser = providerDictionary.GetByProviderGuid(record.ProviderId); } foreach (var p in record.Properties) { var parsed = parser?.ParseProperty(p.Name, record); if (parsed != null && parsed.Any()) { foreach (var parsedProp in parsed) { dict.Add(parsedProp.Key, parsedProp.Value); } } else { dict.Add(p.Name, ParseBasicProperty(p, record)); } } return(dict); }
private string GetRecursiveValue(ICmsContent content, string propertyname, IPropertyParser parser) { this.log.AddLogentry(SolisSearch.Log.Enum.LogLevel.Debug, string.Format("Property {0} is set as recursive, searching ancestors for node {1}", (object)propertyname, (object)content.Name), (Exception)null); string str = string.Empty; if (content.ParentId < 0) { return(str); } for (ICmsContent cmsContent = this.cmsIndexer.GetContentById(content.ParentId); cmsContent != null && cmsContent.Id != this.cmsIndexer.CmsRootId; cmsContent = this.cmsIndexer.GetParent(cmsContent)) { ICmsProperty property = this.cmsIndexer.GetProperty(cmsContent, propertyname); if (property != null && !string.IsNullOrEmpty(property.Value as string)) { str = parser.GetPropertyValue(property.Value); this.log.AddLogentry(SolisSearch.Log.Enum.LogLevel.Debug, string.Format("Found recursive value {0} for property {1} on node {2}", (object)str, (object)propertyname, (object)cmsContent.Name), (Exception)null); break; } } return(str); }
public static IHtmlString FullCalendar(this HtmlHelper htmlHelper, Action <FullCalendarParameters> parameters) { var fullCalendarParameters = new FullCalendarParameters(); parameters(fullCalendarParameters); Dictionary <string, string> attributes = new Dictionary <string, string>(); foreach (var property in typeof(FullCalendarParameters).GetProperties()) { if (property.Name == nameof(FullCalendarParameters.Name) || property.Name == nameof(FullCalendarParameters.CssClass)) { continue; } IPropertyParser propertyParser = PropertyParserFactory.GetPropertyParser(property); propertyParser.AddPropertyToDictionary(fullCalendarParameters, ref attributes); } return(MvcHtmlString.Create(string.Format("<div {0} {1} class=\"fc {2}\" {3}></div>", !string.IsNullOrEmpty(fullCalendarParameters.Name) ? string.Format("id='{0}'", fullCalendarParameters.Name) : "", !string.IsNullOrEmpty(fullCalendarParameters.Name) ? string.Format("name='{0}'", fullCalendarParameters.Name) : "", fullCalendarParameters.CssClass, string.Join(" ", attributes.Select(x => x.Key + "=\"" + x.Value + "\""))))); }