private static ContentDispositionHeaderValue TryParse(ContentDispositionValue cd) { Assert.NotNull(cd); ContentDispositionHeaderValue header; if (cd.Valid) { Assert.True(ContentDispositionHeaderValue.TryParse(cd.Value, out header)); Assert.NotNull(header); } else { Assert.False(ContentDispositionHeaderValue.TryParse(cd.Value, out header)); Assert.Null(header); } return header; }
private static ContentDispositionHeaderValue Parse(ContentDispositionValue cd) { Assert.NotNull(cd); ContentDispositionHeaderValue header = null; if (cd.Valid) { header = ContentDispositionHeaderValue.Parse(cd.Value); Assert.NotNull(header); } else { Assert.Throws<FormatException>(() => { header = ContentDispositionHeaderValue.Parse(cd.Value); }); } return header; }