public void Must_parse_correctly(string headerValue) { AcceptLanguageHeader[] headers = AcceptLanguageHeader.ParseMany(headerValue).ToArray(); Assert.That(headers, Has.Length.EqualTo(4)); Assert.That(headers[0].Language, Is.EqualTo("de")); Assert.That(headers[0].LanguagePrefix, Is.Null); Assert.That(headers[0].LanguageRange, Is.EqualTo("de")); Assert.That(headers[0].Qvalue, Is.EqualTo(1m)); Assert.That(headers[0].EffectiveQvalue, Is.EqualTo(1m)); Assert.That(headers[1].Language, Is.EqualTo("en")); Assert.That(headers[1].LanguagePrefix, Is.Null); Assert.That(headers[1].LanguageRange, Is.EqualTo("en")); Assert.That(headers[1].Qvalue, Is.EqualTo(0.567m)); Assert.That(headers[1].EffectiveQvalue, Is.EqualTo(0.567m)); Assert.That(headers[2].Language, Is.EqualTo("gb")); Assert.That(headers[2].LanguagePrefix, Is.EqualTo("en")); Assert.That(headers[2].LanguageRange, Is.EqualTo("en-gb")); Assert.That(headers[2].Qvalue, Is.Null); Assert.That(headers[2].EffectiveQvalue, Is.EqualTo(1m)); Assert.That(headers[3].Language, Is.EqualTo("fr")); Assert.That(headers[3].LanguagePrefix, Is.Null); Assert.That(headers[3].LanguageRange, Is.EqualTo("fr")); Assert.That(headers[3].Qvalue, Is.EqualTo(0m)); Assert.That(headers[3].EffectiveQvalue, Is.EqualTo(0m)); }
public void Must_not_result_in_header(string headerValue) { Assert.That(AcceptLanguageHeader.ParseMany(headerValue), Is.Empty); }
public void Must_not_match(string headerValue, string languageRange) { AcceptLanguageHeader header = AcceptLanguageHeader.ParseMany(headerValue).Single(); Assert.That(header.LanguageRangeMatches(languageRange), Is.False); }