Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void MapWhenHeaderMissing()
        {
            var headers = new WebHeaderCollection();

            Assert.Equal(-1, headers.Map(HttpResponseHeader.ContentType, -1, delegate { throw new InvalidOperationException(); }));
        }
Ejemplo n.º 3
0
        public void MapWithNullResultor()
        {
            var headers = new WebHeaderCollection();

            Assert.Equal("mapper", Assert.Throws <ArgumentNullException>(() => headers.Map <object>(default(HttpResponseHeader), null)).ParamName);
        }