public void ElementTypeSelector_ShouldBeValueObject() { // Given var underTest = new TypeSelectorElement( name: "test", attributes: Enumerable.Empty<AttributeElement>(), modifiers: Enumerable.Empty<ModifierElement>(), classSelectors: Enumerable.Empty<ClassSelectorElement>()); // Then AssertHelper.AreEqualByValue(underTest, new TypeSelectorElement( "test", Enumerable.Empty<AttributeElement>(), Enumerable.Empty<ModifierElement>(), Enumerable.Empty<ClassSelectorElement>() )); AssertHelper.AreEqualByValue(new TypeSelectorElement(), new TypeSelectorElement()); AssertHelper.AreNotEqualByValue(underTest, new TypeSelectorElement()); }
public void ElementTypeSelector_ShouldBeValueObject() { // Given var underTest = new TypeSelectorElement( name: "test", attributes: Enumerable.Empty <AttributeElement>(), modifiers: Enumerable.Empty <ModifierElement>(), classSelectors: Enumerable.Empty <ClassSelectorElement>()); // Then AssertHelper.AreEqualByValue(underTest, new TypeSelectorElement( "test", Enumerable.Empty <AttributeElement>(), Enumerable.Empty <ModifierElement>(), Enumerable.Empty <ClassSelectorElement>() )); AssertHelper.AreEqualByValue(new TypeSelectorElement(), new TypeSelectorElement()); AssertHelper.AreNotEqualByValue(underTest, new TypeSelectorElement()); }
/// <summary> /// Creates the unary selectorElement. /// </summary> public UnarySelectorElement CreateUnarySelector(TypeSelectorElement typeSelectorElement) { return new UnarySelectorElement(typeSelectorElement); }
/// <summary> /// Creates the unary selectorElement. /// </summary> public UnarySelectorElement CreateUnarySelector(TypeSelectorElement typeSelectorElement) { return(new UnarySelectorElement(typeSelectorElement)); }
protected IEnumerable<SelectorAttribute> ResolverAttributes(TypeSelectorElement typeSelectorElement) { return typeSelectorElement.Attributes .Select(attribute => new SelectorAttribute(attribute.Name, attribute.Value.Value)); }
protected SelectorDescriptor ResolveSelectorDescriptor(TypeSelectorElement typeSelectorElement) { return DescriptorRepository.GetSelectorDescriptors() .SingleOrDefault(s => NameMatcher.Match(s.Value, typeSelectorElement.Name)); }
/// <summary> /// Resolves the class selectors. /// </summary> protected virtual IEnumerable<Regex> ResolveClassSelectors(TypeSelectorElement selector) { return selector.ClassSelectors.Select<ClassSelectorElement, Regex>(classSelector => { var regularClassSelector = classSelector as RegularExpressionClassSelectorElement; if (regularClassSelector != null) return regularClassSelector.Regex; var rawClassSelector = classSelector as RawClassSelectorElement; if (rawClassSelector != null) return new Regex(rawClassSelector.Name); throw new NotSupportedException(String.Format("Not supported class selector element: {0}.", classSelector.GetType().FullName)); }); }
protected IEnumerable<ModifierBase> ResolveModifiers(TypeSelectorElement typeSelectorElement) { return typeSelectorElement.Modifiers .Select(resolveModifier); }