public void Map() { var headers = new WebHeaderCollection { { HttpResponseHeader.ContentType, "text/plain" } }; var contentType = headers.Map(HttpResponseHeader.ContentType, null, h => new ContentType(h)); Assert.NotNull(contentType); Assert.Equal("text/plain", contentType.MediaType); }
public void MapWhenHeaderMissing() { var headers = new WebHeaderCollection(); Assert.Equal(-1, headers.Map(HttpResponseHeader.ContentType, -1, delegate { throw new InvalidOperationException(); })); }
public void MapWithNullResultor() { var headers = new WebHeaderCollection(); Assert.Equal("mapper", Assert.Throws <ArgumentNullException>(() => headers.Map <object>(default(HttpResponseHeader), null)).ParamName); }