public void FindAllContentTypeStringMatch()
        {
            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();
            IEnumerable <HttpContent> result  = content.FindAllContentType(matchContentType);

            Assert.Equal(3, result.Count());
        }
        public void FirstDispositionTypeOrDefaultMatch()
        {
            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();

            Assert.NotNull(content.FirstDispositionTypeOrDefault(matchDispositionType));
            Assert.NotNull(content.FirstDispositionTypeOrDefault(quotedMatchDispositionType));
        }
        public void FindAllContentTypeMediaTypeMatch()
        {
            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();
            IEnumerable <HttpContent> result  = content.FindAllContentType(new MediaTypeHeaderValue(matchContentType));

            Assert.Equal(3, result.Count());
        }
        public void FindAllContentTypeMediaTypeThrows()
        {
            Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FindAllContentType(null, new MediaTypeHeaderValue("text/plain")); }, "contents");

            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();

            Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FindAllContentType(content, (MediaTypeHeaderValue)null); }, "contentType");
        }
        public void FirstDispositionTypeOrDefaultNoMatch()
        {
            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();

            Assert.Null(content.FirstDispositionTypeOrDefault(noMatchDispositionType));

            ClearHeaders(content);
            Assert.Null(content.FirstDispositionTypeOrDefault(noMatchDispositionType));
        }
        public void FirstDispositionNameNoMatch()
        {
            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();

            Assert.Null(content.FirstDispositionNameOrDefault(noMatchDispositionName));

            ClearHeaders(content);
            Assert.Throws <InvalidOperationException>(() => content.FirstDispositionName(noMatchDispositionName));
        }
        public void FindAllContentTypeStringNoMatch()
        {
            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();
            IEnumerable <HttpContent> result  = null;

            result = content.FindAllContentType(noMatchContentType);
            Assert.Equal(0, result.Count());

            ClearHeaders(content);
            result = content.FindAllContentType(noMatchContentType);
            Assert.Equal(0, result.Count());
        }
        public void FindAllContentTypeString()
        {
            Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FindAllContentType(null, "text/plain"); }, "contents");

            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();

            Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FindAllContentType(content, (string)null); }, "contentType");
            foreach (string empty in TestData.EmptyStrings)
            {
                Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FindAllContentType(content, empty); }, "contentType");
            }
        }
        public void FirstStartOrDefaultThrows()
        {
            Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FirstStartOrDefault(null, "A"); }, "contents");

            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();

            Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FirstStartOrDefault(content, null); }, "start");
            foreach (string empty in TestData.EmptyStrings)
            {
                Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FirstStartOrDefault(content, empty); }, "start");
            }
        }
        public void FirstDispositionTypeThrows()
        {
            Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FirstDispositionType(null, "A"); }, "contents");

            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();

            Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FirstDispositionType(content, null); }, "dispositionType");
            foreach (string empty in TestData.EmptyStrings)
            {
                Assert.ThrowsArgumentNull(() => { HttpContentCollectionExtensions.FirstDispositionType(content, empty); }, "dispositionType");
            }
        }
        public void FirstStartOrDefaultMatch()
        {
            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();

            Assert.NotNull(content.FirstStartOrDefault(matchContentID));
        }
        public void FirstStartNoMatch()
        {
            IEnumerable <HttpContent> content = HttpContentCollectionExtensionsTests.CreateContent();

            Assert.Throws <InvalidOperationException>(() => content.FirstStart(noMatchContentID));
        }