public void Add()
        {
            var m = new MultipartContent ("a", "b");

            var other = new MultipartContent ("2", "44");
            other.Headers.Expires = new DateTimeOffset (2020, 11, 30, 19, 55, 22, TimeSpan.Zero);
            m.Add (other);

            Assert.AreEqual ("multipart/a", m.Headers.ContentType.MediaType, "#1");
            Assert.AreEqual (114, m.Headers.ContentLength, "#2");
            Assert.AreEqual ("--b\r\nContent-Type: multipart/2; boundary=\"44\"\r\nExpires: Mon, 30 Nov 2020 19:55:22 GMT\r\n\r\n--44\r\n\r\n--44--\r\n\r\n--b--\r\n", m.ReadAsStringAsync ().Result, "#3");
            Assert.AreEqual (other, m.First (), "#4");
        }
        public void Add()
        {
            var m = new MultipartContent("a", "b");

            var other = new MultipartContent("2", "44");

            other.Headers.Expires = new DateTimeOffset(2020, 11, 30, 19, 55, 22, TimeSpan.Zero);
            m.Add(other);

            Assert.AreEqual("multipart/a", m.Headers.ContentType.MediaType, "#1");
            Assert.AreEqual(114, m.Headers.ContentLength, "#2");
            Assert.AreEqual("--b\r\nContent-Type: multipart/2; boundary=\"44\"\r\nExpires: Mon, 30 Nov 2020 19:55:22 GMT\r\n\r\n--44\r\n\r\n--44--\r\n\r\n--b--\r\n", m.ReadAsStringAsync().Result, "#3");
            Assert.AreEqual(other, m.First(), "#4");
        }
        public void Add_2()
        {
            var m = new MultipartContent ("a", "X");

            var other = new MultipartContent ("2", "2a");
            m.Add (other);
            var other2 = new MultipartContent ("3", "3a");
            other2.Headers.Add ("9", "9n");
            m.Add (other2);

            Assert.AreEqual ("multipart/a", m.Headers.ContentType.MediaType, "#1");
            Assert.AreEqual (148, m.Headers.ContentLength, "#2");
            Assert.AreEqual ("--X\r\nContent-Type: multipart/2; boundary=\"2a\"\r\n\r\n--2a\r\n\r\n--2a--\r\n\r\n--X\r\nContent-Type: multipart/3; boundary=\"3a\"\r\n9: 9n\r\n\r\n--3a\r\n\r\n--3a--\r\n\r\n--X--\r\n",
                m.ReadAsStringAsync ().Result, "#3");
            Assert.AreEqual (other, m.First (), "#4");
        }
        public void Add_Resursive()
        {
            var m = new MultipartContent("1", "1a");

            var other = new MultipartContent("2", "2a");

            m.Add(other);

            var other2 = new MultipartContent("3", "3a");

            other.Add(other2);

            Assert.AreEqual("multipart/1", m.Headers.ContentType.MediaType, "#1");
            Assert.AreEqual(136, m.Headers.ContentLength, "#2");
            Assert.AreEqual("--1a\r\nContent-Type: multipart/2; boundary=\"2a\"\r\n\r\n--2a\r\nContent-Type: multipart/3; boundary=\"3a\"\r\n\r\n--3a\r\n\r\n--3a--\r\n\r\n--2a--\r\n\r\n--1a--\r\n",
                            m.ReadAsStringAsync().Result, "#3");
            Assert.AreEqual(other, m.First(), "#4");
        }
        public void Add_2()
        {
            var m = new MultipartContent("a", "X");

            var other = new MultipartContent("2", "2a");

            m.Add(other);
            var other2 = new MultipartContent("3", "3a");

            other2.Headers.Add("9", "9n");
            m.Add(other2);

            Assert.AreEqual("multipart/a", m.Headers.ContentType.MediaType, "#1");
            Assert.AreEqual(148, m.Headers.ContentLength, "#2");
            Assert.AreEqual("--X\r\nContent-Type: multipart/2; boundary=\"2a\"\r\n\r\n--2a\r\n\r\n--2a--\r\n\r\n--X\r\nContent-Type: multipart/3; boundary=\"3a\"\r\n9: 9n\r\n\r\n--3a\r\n\r\n--3a--\r\n\r\n--X--\r\n",
                            m.ReadAsStringAsync().Result, "#3");
            Assert.AreEqual(other, m.First(), "#4");
        }
Exemplo n.º 6
0
		public void Add_Resursive ()
		{
			var m = new MultipartContent ("1", "1a");

			var other = new MultipartContent ("2", "2a");
			m.Add (other);

			var other2 = new MultipartContent ("3", "3a");
			other.Add (other2);

			Assert.AreEqual ("multipart/1", m.Headers.ContentType.MediaType, "#1");
			Assert.AreEqual (136, m.Headers.ContentLength, "#2");
			Assert.AreEqual ("--1a\r\nContent-Type: multipart/2; boundary=\"2a\"\r\n\r\n--2a\r\nContent-Type: multipart/3; boundary=\"3a\"\r\n\r\n--3a\r\n\r\n--3a--\r\n\r\n--2a--\r\n\r\n--1a--\r\n",
				m.ReadAsStringAsync ().Result, "#3");
			Assert.AreEqual (other, m.First (), "#4");
		}