public void Create_EmptyContentTypesProduceDefaults()
        {
            var info = new HttpRequestInfo
            {
                RequestUri = new Uri("http://tests")
            };

            info.ContentTypes.Clear();

            var result = info.CreateRequestMessage();

            result.Headers.Accept.Should().HaveCount(2);
        }
        public void Create_UserAgentPreserved(string userAgent)
        {
            var info = new HttpRequestInfo
            {
                RequestUri = new Uri("http://tests"),
                UserAgent  = userAgent
            };

            var result = info.CreateRequestMessage();

            var resultAgents = result.Headers.UserAgent.OfType <ProductInfoHeaderValue>().Select(v => v.Product.Name);

            resultAgents.Should().BeEquivalentTo(userAgent);
        }
        public void Create_ContentTypesPreserved(string contentType)
        {
            var info = new HttpRequestInfo
            {
                RequestUri = new Uri("http://tests"),
                Content    = "abcdef"
            };

            info.ContentTypes.Add(contentType);

            var result = info.CreateRequestMessage();

            var resultContentTypes = result.Content.Headers.ContentType as MediaTypeWithQualityHeaderValue;

            resultContentTypes.MediaType.Should().Be(contentType);
        }