/// <inheritdoc /> /// <remarks><see cref="Name"/> is compared case-insensitively.</remarks> public bool Equals(IReadOnlyTagHelperAttribute other) { return (other != null && string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase) && Minimized == other.Minimized && (Minimized || Equals(Value, other.Value))); }
/// <inheritdoc /> /// <remarks><see cref="Name"/> is compared case-insensitively.</remarks> public bool Equals(IReadOnlyTagHelperAttribute other) { return other != null && string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase) && Minimized == other.Minimized && (Minimized || Equals(Value, other.Value)); }
/// <summary> /// Instantiates a new instance of <see cref="TagHelperAttribute" /> with values provided by the given /// <paramref name="attribute"/>. /// </summary> /// <param name="attribute">A <see cref="IReadOnlyTagHelperAttribute"/> whose values should be copied.</param> public TagHelperAttribute(IReadOnlyTagHelperAttribute attribute) : this(attribute?.Name, attribute?.Value) { if (attribute == null) { throw new ArgumentNullException(nameof(attribute)); } Minimized = attribute.Minimized; }
public void CopyConstructorCopiesValuesAsExpected(IReadOnlyTagHelperAttribute readOnlyTagHelperAttribute) { // Act var tagHelperAttribute = new TagHelperAttribute(readOnlyTagHelperAttribute); // Assert Assert.Equal( readOnlyTagHelperAttribute, tagHelperAttribute, CaseSensitiveTagHelperAttributeComparer.Default); }
public void IndexOf_ReturnsExpectedResult( IEnumerable <IReadOnlyTagHelperAttribute> initialAttributes, IReadOnlyTagHelperAttribute attributeToLookup, int expected) { // Arrange var attributes = new ReadOnlyTagHelperAttributeList <IReadOnlyTagHelperAttribute>(initialAttributes); // Act var index = attributes.IndexOf(attributeToLookup); // Assert Assert.Equal(expected, index); }
public void IntIndexer_ReturnsExpectedAttribute( IEnumerable <IReadOnlyTagHelperAttribute> initialAttributes, int indexToLookup, IReadOnlyTagHelperAttribute expectedAttribute) { // Arrange var attributes = new ReadOnlyTagHelperAttributeList <IReadOnlyTagHelperAttribute>(initialAttributes); // Act var attribute = attributes[indexToLookup]; // Assert Assert.Equal(expectedAttribute, attribute, CaseSensitiveTagHelperAttributeComparer.Default); }
public void Contains_ReturnsExpectedResult( IEnumerable <IReadOnlyTagHelperAttribute> initialAttributes, IReadOnlyTagHelperAttribute attributeToLookup, bool expected) { // Arrange var attributes = new ReadOnlyTagHelperAttributeList <IReadOnlyTagHelperAttribute>(initialAttributes); // Act var contains = attributes.Contains(attributeToLookup); // Assert Assert.Equal(expected, contains); }
public void ModifyingUnderlyingAttributes_StringIndexer_ReturnsExpectedResult( IEnumerable <IReadOnlyTagHelperAttribute> initialAttributes, string nameToLookup, IReadOnlyTagHelperAttribute expectedAttribute) { // Arrange var attributes = new TestableReadOnlyTagHelperAttributes(Enumerable.Empty <IReadOnlyTagHelperAttribute>()); attributes.PublicAttributes.AddRange(initialAttributes); // Act var attribute = attributes[nameToLookup]; // Assert Assert.Equal(expectedAttribute, attribute, CaseSensitiveTagHelperAttributeComparer.Default); }
public void TryGetAttribute_ReturnsExpectedValueAndAttribute( IEnumerable <IReadOnlyTagHelperAttribute> initialAttributes, string nameToLookup, IReadOnlyTagHelperAttribute expectedAttribute, bool expectedResult) { // Arrange var attributes = new ReadOnlyTagHelperAttributeList <IReadOnlyTagHelperAttribute>(initialAttributes); IReadOnlyTagHelperAttribute attribute; // Act var result = attributes.TryGetAttribute(nameToLookup, out attribute); // Assert Assert.Equal(expectedResult, result); Assert.Equal(expectedAttribute, attribute, CaseSensitiveTagHelperAttributeComparer.Default); }