public void acceptencoding___ctor_basic_returns_type(string value, int expectedCount) { var header = new AcceptEncodingHeader($"{value}"); header.Should().NotBeNull(); header.Value.Should().Be(value); header.Values.Should().NotBeNull(); header.Values.Should().HaveCount(expectedCount); }
public void acceptencoding___ctor_returns_default_for_null_or_whitespace(string value) { var header = new AcceptEncodingHeader(value); header.Should().NotBeNull(); header.Value.Should().Be(value); header.Values.Should().NotBeNull(); header.Values.Should().BeEmpty(); }
public void acceptencoding___gethashcode_success() { AcceptEncodingHeader header = "en-us;"; header.Should().NotBeNull(); var hashCode = header.GetHashCode(); hashCode.Should().NotBe(0); }
public void acceptencoding___ctor_qualities_modified_when_outofrange() { var value = "gzip;q=-1, deflate; q=1.1, compress; q=0.7, *; q=0.5"; var header = new AcceptEncodingHeader(value); header.Should().NotBeNull(); header.Value.Should().Be(value); header.Values.Should().NotBeNull(); header.Values.Should().HaveCount(4); header.Values[0].Encoding.Should().Be("deflate"); header.Values[0].Quality.Should().Be(1f); header.Values[1].Encoding.Should().Be("compress"); header.Values[1].Quality.Should().Be(0.7f); header.Values[2].Encoding.Should().Be("*"); header.Values[2].Quality.Should().Be(0.5f); header.Values[3].Encoding.Should().Be("gzip"); header.Values[3].Quality.Should().Be(0f); }
public void acceptencoding___assignment_standard_orders_byquality() { var value = "gzip;q=0.1, deflate; q=1, compress; q=0.7, *; q=0.5"; AcceptEncodingHeader header = value; header.Should().NotBeNull(); header.Value.Should().Be(value); header.Values.Should().NotBeNull(); header.Values.Should().HaveCount(4); header.Values[0].Encoding.Should().Be("deflate"); header.Values[0].Quality.Should().Be(1f); header.Values[1].Encoding.Should().Be("compress"); header.Values[1].Quality.Should().Be(0.7f); header.Values[2].Encoding.Should().Be("*"); header.Values[2].Quality.Should().Be(0.5f); header.Values[3].Encoding.Should().Be("gzip"); header.Values[3].Quality.Should().Be(0.1f); }
public void acceptencoding___assignment_charsets_quality_set_to_0_when_quality_invalid() { var value = "gzip;q=0.1, deflate; q=ABC, compress; q=0.7, *; q=0.5"; AcceptEncodingHeader header = value; header.Should().NotBeNull(); header.Value.Should().Be(value); header.Values.Should().NotBeNull(); header.Values.Should().HaveCount(4); header.Values[0].Encoding.Should().Be("compress"); header.Values[0].Quality.Should().Be(0.7f); header.Values[1].Encoding.Should().Be("*"); header.Values[1].Quality.Should().Be(0.5f); header.Values[2].Encoding.Should().Be("gzip"); header.Values[2].Quality.Should().Be(0.1f); header.Values[3].Encoding.Should().Be("deflate"); header.Values[3].Quality.Should().Be(0f); }