示例#1
0
        public void op_FromString_string()
        {
            var expected = new HttpHeader("name", "value");
            var actual = HttpHeader.FromString("name: value");

            Assert.Equal(expected, actual);
        }
示例#2
0
        public void opImplicit_HttpHeader_string()
        {
            var expected = new HttpHeader("name", "value");
            HttpHeader actual = "name: value";

            Assert.Equal(expected, actual);
        }
        public void op_Add_HttpHeader()
        {
            var expected = new HttpHeader("name", "value");

            var obj = new HttpHeaderDictionary
                          {
                              expected
                          };

            Assert.Equal("value", obj["name"]);
        }
        public void op_Add_HttpHeader()
        {
            var header = new HttpHeader("name", "value");
            var mock = new Mock<IHttpMessageHeaders>();
            mock
                .Setup(x => x.Add(header))
                .Verifiable();

            mock.Object.Add(header);

            mock.VerifyAll();
        }
        public void IEnumerable_op_GetEnumerator()
        {
            var item = new HttpHeader("name", "value");
            var obj = new HttpHeaderCollection
                          {
                              item
                          };

            var enumerator = (obj as IEnumerable).GetEnumerator();
            enumerator.MoveNext();
            Assert.Same(item, enumerator.Current);
        }
        public void op_Remove_IHttpHeader()
        {
            var item = new HttpHeader("name", "value");
            var obj = new HttpHeaderCollection
                          {
                              item
                          };

            obj.Remove(item);

            Assert.Equal(0, obj.Count);
        }
        public void op_GetEnumerator()
        {
            var item = new HttpHeader("name", "value");
            var obj = new HttpHeaderCollection
                          {
                              item
                          };

            using (var enumerator = obj.GetEnumerator())
            {
                enumerator.MoveNext();
                Assert.Same(item, enumerator.Current);
            }
        }
        public void op_CopyTo_IHttpHeader_int()
        {
            var item = new HttpHeader("name", "value");
            var obj = new HttpHeaderCollection
                          {
                              item
                          };

            var array = new IHttpHeader[1];

            obj.CopyTo(array, 0);

            Assert.Equal(item, (HttpHeader)array[0]);
        }
        public void op_Contains_IHttpHeader_whenTrue()
        {
            var item = new HttpHeader("name", "value");
            var obj = new HttpHeaderCollection
                          {
                              item
                          };

            Assert.True(obj.Contains(item));
        }
        public void op_Add_IHttpHeader()
        {
            var obj = new HttpHeaderCollection();
            var item = new HttpHeader("name", "value");

            Assert.Equal(0, obj.Count);

            obj.Add(item);

            Assert.Equal(1, obj.Count);
        }
示例#11
0
        public void op_FromString_string_whenEndsWithColon()
        {
            var expected = new HttpHeader("name", string.Empty);
            var actual = HttpHeader.FromString("name:");

            Assert.Equal(expected, actual);
        }
示例#12
0
        public void op_ToString()
        {
            const string expected = "name: value";
            var actual = new HttpHeader("name", "value").ToString();

            Assert.Equal(expected, actual);
        }