Example #1
0
        public void Defaults()
        {
            ConcreteHttpWebRequest hwr = new ConcreteHttpWebRequest();

            Assert.Throws <NotImplementedException> (delegate {
                hwr.Abort();
            }, "Abort");

            Assert.Throws <NotImplementedException> (delegate {
                Assert.IsFalse(hwr.AllowReadStreamBuffering);
            }, "AllowReadStreamBuffering-get");
            Assert.Throws <NotImplementedException> (delegate {
                hwr.AllowReadStreamBuffering = true;
            }, "AllowReadStreamBuffering-set");

            // new in SL4
            Assert.Throws <NotImplementedException> (delegate {
                Assert.IsFalse(hwr.AllowWriteStreamBuffering);
            }, "AllowWriteStreamBuffering-get");
            Assert.Throws <NotImplementedException> (delegate {
                hwr.AllowWriteStreamBuffering = true;
            }, "AllowWriteStreamBuffering-set");

            Assert.Throws <NotImplementedException> (delegate {
                hwr.BeginGetRequestStream(null, null);
            }, "BeginGetRequestStream");

            Assert.Throws <NotImplementedException> (delegate {
                hwr.BeginGetResponse(null, null);
            }, "BeginGetResponse");

            Assert.Throws <NotImplementedException> (delegate {
                hwr.EndGetRequestStream(null);
            }, "EndGetRequestStream");

            Assert.Throws <NotImplementedException> (delegate {
                hwr.EndGetResponse(null);
            }, "EndGetResponse");

            Assert.Throws <NotImplementedException> (delegate {
                Assert.IsFalse(hwr.HaveResponse);
            }, "HaveResponse");

            Assert.AreEqual(0, hwr.Headers.Count, "Headers-get");
            Assert.Throws <NullReferenceException> (delegate {
                hwr.Headers = null;
            }, "Headers-set-null");
            hwr.Headers = new WebHeaderCollection();
            Assert.IsNotNull(hwr.Headers, "Headers-set");

            Assert.Throws <NotImplementedException> (delegate {
                Assert.IsNull(hwr.Method);
            }, "Method-get");
            Assert.Throws <NotImplementedException> (delegate {
                hwr.Method = null;
            }, "Method-set");

            Assert.Throws <NotImplementedException> (delegate {
                Assert.IsNull(hwr.RequestUri);
            }, "RequestUri-get");

            // new in SL3
            Assert.Throws <NotImplementedException> (delegate {
                Assert.IsNull(hwr.CookieContainer);
            }, "CookieContainer-get");
            Assert.Throws <NotImplementedException> (delegate {
                hwr.CookieContainer = null;
            }, "CookieContainer-set");

            // new in SL4
            Assert.IsFalse(hwr.SupportsCookieContainer, "SupportsCookieContainer");

            Assert.IsNull(hwr.CreatorInstance, "CreatorInstance");
        }
Example #2
0
		public void Defaults ()
		{
			ConcreteHttpWebRequest hwr = new ConcreteHttpWebRequest ();

			Assert.Throws<NotImplementedException> (delegate {
				hwr.Abort ();
			}, "Abort");

			Assert.Throws<NotImplementedException> (delegate {
				Assert.IsFalse (hwr.AllowReadStreamBuffering);
			}, "AllowReadStreamBuffering-get");
			Assert.Throws<NotImplementedException> (delegate {
				hwr.AllowReadStreamBuffering = true;
			}, "AllowReadStreamBuffering-set");

			// new in SL4
			Assert.Throws<NotImplementedException> (delegate {
				Assert.IsFalse (hwr.AllowWriteStreamBuffering);
			}, "AllowWriteStreamBuffering-get");
			Assert.Throws<NotImplementedException> (delegate {
				hwr.AllowWriteStreamBuffering = true;
			}, "AllowWriteStreamBuffering-set");

			Assert.Throws<NotImplementedException> (delegate {
				hwr.BeginGetRequestStream (null, null);
			}, "BeginGetRequestStream");

			Assert.Throws<NotImplementedException> (delegate {
				hwr.BeginGetResponse (null, null);
			}, "BeginGetResponse");

			Assert.Throws<NotImplementedException> (delegate {
				hwr.EndGetRequestStream (null);
			}, "EndGetRequestStream");

			Assert.Throws<NotImplementedException> (delegate {
				hwr.EndGetResponse (null);
			}, "EndGetResponse");

			Assert.Throws<NotImplementedException> (delegate {
				Assert.IsFalse (hwr.HaveResponse);
			}, "HaveResponse");

			Assert.AreEqual (0, hwr.Headers.Count, "Headers-get");
			Assert.Throws<NullReferenceException> (delegate {
				hwr.Headers = null;
			}, "Headers-set-null");
			hwr.Headers = new WebHeaderCollection ();
			Assert.IsNotNull (hwr.Headers, "Headers-set");

			Assert.Throws<NotImplementedException> (delegate {
				Assert.IsNull (hwr.Method);
			}, "Method-get");
			Assert.Throws<NotImplementedException> (delegate {
				hwr.Method = null;
			}, "Method-set");

			Assert.Throws<NotImplementedException> (delegate {
				Assert.IsNull (hwr.RequestUri);
			}, "RequestUri-get");

			// new in SL3
			Assert.Throws<NotImplementedException> (delegate {
				Assert.IsNull (hwr.CookieContainer);
			}, "CookieContainer-get");
			Assert.Throws<NotImplementedException> (delegate {
				hwr.CookieContainer = null;
			}, "CookieContainer-set");

			// new in SL4
			Assert.IsFalse (hwr.SupportsCookieContainer, "SupportsCookieContainer");

			Assert.IsNull (hwr.CreatorInstance, "CreatorInstance");
		}