public void Parse_InvalidValue_Throw() { // This test verifies that Parse() correctly calls TryParse(). TransferCodingHeaderParser parser = TransferCodingHeaderParser.MultipleValueParser; int index = 0; Assert.Throws <FormatException>(() => { parser.ParseValue("custom;=value", null, ref index); }); }
public void Parse_ValidValue_ReturnsTransferCodingHeaderValue() { // This test verifies that Parse() correctly calls TryParse(). TransferCodingHeaderParser parser = TransferCodingHeaderParser.MultipleValueParser; int index = 2; TransferCodingHeaderValue expected = new TransferCodingHeaderValue("custom"); expected.Parameters.Add(new NameValueHeaderValue("name", "value")); Assert.True(expected.Equals(parser.ParseValue(" custom ; name = value ", null, ref index))); Assert.Equal(25, index); }