private void CheckInvalidParse(string input) { Assert.Throws <FormatException>(() => { TransferCodingWithQualityHeaderValue.Parse(input); }); Assert.False(TransferCodingWithQualityHeaderValue.TryParse(input, out TransferCodingWithQualityHeaderValue result)); Assert.Null(result); }
private void CheckValidParse(string input, TransferCodingWithQualityHeaderValue expectedResult) { TransferCodingWithQualityHeaderValue result = TransferCodingWithQualityHeaderValue.Parse(input); Assert.Equal(expectedResult, result); Assert.True(TransferCodingWithQualityHeaderValue.TryParse(input, out result)); Assert.Equal(expectedResult, result); }
public void Parse_Invalid() { try { TransferCodingWithQualityHeaderValue.Parse(null); Assert.Fail("#1"); } catch (FormatException) { } try { TransferCodingWithQualityHeaderValue.Parse(" "); Assert.Fail("#2"); } catch (FormatException) { } }
public void Parse() { var res = TransferCodingWithQualityHeaderValue.Parse("1.1"); Assert.AreEqual(0, res.Parameters.Count, "#1"); Assert.IsNull(res.Quality, "#1b"); Assert.AreEqual("1.1", res.Value, "#1c"); Assert.AreEqual("1.1", res.ToString(), "#1d"); res = TransferCodingWithQualityHeaderValue.Parse("a ; b "); Assert.AreEqual(1, res.Parameters.Count, "#2"); Assert.IsNull(res.Quality, "#2b"); Assert.AreEqual("a", res.Value, "#2c"); Assert.AreEqual("a; b", res.ToString(), "#2d"); }
private void CheckInvalidParse(string input) { Assert.Throws <FormatException>(() => { TransferCodingWithQualityHeaderValue.Parse(input); }); }