public void AreEqualCollections_UseSetOfNotEqualCollections_ReturnsFalse() { ICollection <NameValueHeaderValue> x = new List <NameValueHeaderValue>(); ICollection <NameValueHeaderValue> y = new List <NameValueHeaderValue>(); Assert.True(HeaderUtilities.AreEqualCollections(x, y), "Expected '<empty>' == '<empty>'"); x.Add(new NameValueHeaderValue("a")); x.Add(new NameValueHeaderValue("c")); x.Add(new NameValueHeaderValue("b")); x.Add(new NameValueHeaderValue("c")); y.Add(new NameValueHeaderValue("a")); y.Add(new NameValueHeaderValue("b")); y.Add(new NameValueHeaderValue("c")); y.Add(new NameValueHeaderValue("d")); Assert.False(HeaderUtilities.AreEqualCollections(x, y)); Assert.False(HeaderUtilities.AreEqualCollections(y, x)); y.Clear(); y.Add(new NameValueHeaderValue("a")); y.Add(new NameValueHeaderValue("b")); y.Add(new NameValueHeaderValue("b")); y.Add(new NameValueHeaderValue("c")); Assert.False(HeaderUtilities.AreEqualCollections(x, y)); Assert.False(HeaderUtilities.AreEqualCollections(y, x)); }
/// <inheritdoc /> public override bool Equals(object?obj) { var other = obj as ContentDispositionHeaderValue; if (other == null) { return(false); } return(_dispositionType.Equals(other._dispositionType, StringComparison.OrdinalIgnoreCase) && HeaderUtilities.AreEqualCollections(_parameters, other._parameters)); }
/// <inheritdoc /> public override bool Equals(object?obj) { var other = obj as RangeHeaderValue; if (other == null) { return(false); } return(StringSegment.Equals(_unit, other._unit, StringComparison.OrdinalIgnoreCase) && HeaderUtilities.AreEqualCollections(Ranges, other.Ranges)); }
public void AreEqualCollections_UseSetOfEqualCollections_ReturnsTrue() { ICollection <NameValueHeaderValue> x = new List <NameValueHeaderValue>(); ICollection <NameValueHeaderValue> y = new List <NameValueHeaderValue>(); Assert.True(HeaderUtilities.AreEqualCollections(x, y)); x.Add(new NameValueHeaderValue("a")); x.Add(new NameValueHeaderValue("c")); x.Add(new NameValueHeaderValue("b")); x.Add(new NameValueHeaderValue("c")); y.Add(new NameValueHeaderValue("c")); y.Add(new NameValueHeaderValue("c")); y.Add(new NameValueHeaderValue("b")); y.Add(new NameValueHeaderValue("a")); Assert.True(HeaderUtilities.AreEqualCollections(x, y)); Assert.True(HeaderUtilities.AreEqualCollections(y, x)); }
public void AreEqualCollections_UseSetOfEqualCollections_ReturnsTrue() { var x = new UnvalidatedObjectCollection <NameValueHeaderValue>(); var y = new UnvalidatedObjectCollection <NameValueHeaderValue>(); Assert.True(HeaderUtilities.AreEqualCollections(x, y)); x.Add(new NameValueHeaderValue("a")); x.Add(new NameValueHeaderValue("c")); x.Add(new NameValueHeaderValue("b")); x.Add(new NameValueHeaderValue("c")); y.Add(new NameValueHeaderValue("c")); y.Add(new NameValueHeaderValue("c")); y.Add(new NameValueHeaderValue("b")); y.Add(new NameValueHeaderValue("a")); Assert.True(HeaderUtilities.AreEqualCollections(x, y)); Assert.True(HeaderUtilities.AreEqualCollections(y, x)); }
/// <inheritdoc /> public override bool Equals(object?obj) { var other = obj as SetCookieHeaderValue; if (other == null) { return(false); } return(StringSegment.Equals(_name, other._name, StringComparison.OrdinalIgnoreCase) && StringSegment.Equals(_value, other._value, StringComparison.OrdinalIgnoreCase) && Expires.Equals(other.Expires) && MaxAge.Equals(other.MaxAge) && StringSegment.Equals(Domain, other.Domain, StringComparison.OrdinalIgnoreCase) && StringSegment.Equals(Path, other.Path, StringComparison.OrdinalIgnoreCase) && Secure == other.Secure && SameSite == other.SameSite && HttpOnly == other.HttpOnly && HeaderUtilities.AreEqualCollections(Extensions, other.Extensions, StringSegmentComparer.OrdinalIgnoreCase)); }
/// <inheritdoc /> public override bool Equals(object?obj) { var other = obj as CacheControlHeaderValue; if (other == null) { return(false); } if ((_noCache != other._noCache) || (_noStore != other._noStore) || (_maxAge != other._maxAge) || (_sharedMaxAge != other._sharedMaxAge) || (_maxStale != other._maxStale) || (_maxStaleLimit != other._maxStaleLimit) || (_minFresh != other._minFresh) || (_noTransform != other._noTransform) || (_onlyIfCached != other._onlyIfCached) || (_public != other._public) || (_private != other._private) || (_mustRevalidate != other._mustRevalidate) || (_proxyRevalidate != other._proxyRevalidate)) { return(false); } if (!HeaderUtilities.AreEqualCollections(_noCacheHeaders, other._noCacheHeaders, StringSegmentComparer.OrdinalIgnoreCase)) { return(false); } if (!HeaderUtilities.AreEqualCollections(_privateHeaders, other._privateHeaders, StringSegmentComparer.OrdinalIgnoreCase)) { return(false); } if (!HeaderUtilities.AreEqualCollections(_extensions, other._extensions)) { return(false); } return(true); }