public void acceptlanguage___ctor_basic_returns_type(string value, int expectedCount) { var header = new AcceptLanguageHeader($"{value}"); header.Should().NotBeNull(); header.Value.Should().Be(value); header.Values.Should().NotBeNull(); header.Values.Should().HaveCount(expectedCount); }
public void acceptlanguage___ctor_returns_default_for_null_or_whitespace(string value) { var header = new AcceptLanguageHeader(value); header.Should().NotBeNull(); header.Value.Should().Be(value); header.Values.Should().NotBeNull(); header.Values.Should().BeEmpty(); }
public void acceptlanguage___gethashcode_success() { AcceptLanguageHeader header = "en-us;"; header.Should().NotBeNull(); var hashCode = header.GetHashCode(); hashCode.Should().NotBe(0); }
public void acceptlanguage___ctor_qualities_modified_when_outofrange() { var value = "en-US;q=-1, es-ES; q=1.1, de; q=0.7, *; q=0.5"; var header = new AcceptLanguageHeader(value); header.Should().NotBeNull(); header.Value.Should().Be(value); header.Values.Should().NotBeNull(); header.Values.Should().HaveCount(4); header.Values[0].Code.Should().Be("es-ES"); header.Values[0].Quality.Should().Be(1f); header.Values[1].Code.Should().Be("de"); header.Values[1].Quality.Should().Be(0.7f); header.Values[2].Code.Should().Be("*"); header.Values[2].Quality.Should().Be(0.5f); header.Values[3].Code.Should().Be("en-US"); header.Values[3].Quality.Should().Be(0f); }
public void acceptlanguage___assignment_standard_orders_byquality() { var value = "en-US;q=0.1, es-ES; q=1, de; q=0.7, *; q=0.5"; AcceptLanguageHeader header = value; header.Should().NotBeNull(); header.Value.Should().Be(value); header.Values.Should().NotBeNull(); header.Values.Should().HaveCount(4); header.Values[0].Code.Should().Be("es-ES"); header.Values[0].Quality.Should().Be(1f); header.Values[1].Code.Should().Be("de"); header.Values[1].Quality.Should().Be(0.7f); header.Values[2].Code.Should().Be("*"); header.Values[2].Quality.Should().Be(0.5f); header.Values[3].Code.Should().Be("en-US"); header.Values[3].Quality.Should().Be(0.1f); }
public void acceptlanguage___assignment_charsets_quality_set_to_0_when_quality_invalid() { var value = "en-US;q=0.1, es-ES; q=ABC, de; q=0.7, *; q=0.5"; AcceptLanguageHeader header = value; header.Should().NotBeNull(); header.Value.Should().Be(value); header.Values.Should().NotBeNull(); header.Values.Should().HaveCount(4); header.Values[0].Code.Should().Be("de"); header.Values[0].Quality.Should().Be(0.7f); header.Values[1].Code.Should().Be("*"); header.Values[1].Quality.Should().Be(0.5f); header.Values[2].Code.Should().Be("en-US"); header.Values[2].Quality.Should().Be(0.1f); header.Values[3].Code.Should().Be("es-ES"); header.Values[3].Quality.Should().Be(0f); }