public void Equals() { var value = new StringWithQualityHeaderValue ("ab"); Assert.AreEqual (value, new StringWithQualityHeaderValue ("ab"), "#1"); Assert.AreEqual (value, new StringWithQualityHeaderValue ("AB"), "#2"); Assert.AreNotEqual (value, new StringWithQualityHeaderValue ("AA"), "#3"); Assert.AreEqual ("ab", value.ToString (), "#33"); value = new StringWithQualityHeaderValue ("ab", 1); Assert.AreEqual (value, new StringWithQualityHeaderValue ("Ab", 1), "#4"); Assert.AreNotEqual (value, new StringWithQualityHeaderValue ("AB", 0), "#5"); Assert.AreNotEqual (value, new StringWithQualityHeaderValue ("AA", 1), "#6"); }
public void ToString_UseDifferentValues_AllSerializedCorrectly() { StringWithQualityHeaderValue value = new StringWithQualityHeaderValue("token"); Assert.Equal("token", value.ToString()); value = new StringWithQualityHeaderValue("token", 0.1); Assert.Equal("token; q=0.1", value.ToString()); value = new StringWithQualityHeaderValue("token", 0); Assert.Equal("token; q=0.0", value.ToString()); value = new StringWithQualityHeaderValue("token", 1); Assert.Equal("token; q=1.0", value.ToString()); // Note that the quality value gets rounded value = new StringWithQualityHeaderValue("token", 0.56789); Assert.Equal("token; q=0.568", value.ToString()); }
public void Ctor() { var a = new StringWithQualityHeaderValue ("s", 0.123456); Assert.AreEqual ("s; q=0.123", a.ToString ()); }