HttpContext Cook(int re)
        {
            FakeHttpWorkerRequest f = new FakeHttpWorkerRequest(re);
            HttpContext           c = new HttpContext(f);

            return(c);
        }
Beispiel #2
0
        [Test] public void TestDefaults()
        {
            FakeHttpWorkerRequest f = new FakeHttpWorkerRequest();

            Assert.AreEqual(null, f.MachineConfigPath, "F1");
            Assert.AreEqual(null, f.MapPath("x"), "F2");
            Assert.AreEqual(null, f.MachineConfigPath, "F3");
            Assert.AreEqual(null, f.MachineInstallDirectory, "F4");
            Assert.AreEqual("BLABA", f.GetAppPath(), "F5");
            Assert.AreEqual(null, f.GetAppPathTranslated(), "F5");
            Assert.AreEqual(null, f.GetAppPoolID(), "F6");
            Assert.AreEqual(0, f.GetBytesRead(), "F7");
            Assert.AreEqual(new byte [0], f.GetClientCertificate(), "F8");
            Assert.AreEqual(new byte [0], f.GetClientCertificateBinaryIssuer(), "F9");
            Assert.AreEqual(0, f.GetClientCertificateEncoding(), "F10");
            Assert.AreEqual(new byte [0], f.GetClientCertificatePublicKey(), "F11");

            Assert.AreEqual(0, f.GetConnectionID(), "F14");
            Assert.AreEqual(null, f.GetFilePathTranslated(), "F16");
            Assert.AreEqual("", f.GetPathInfo(), "F17");
            Assert.AreEqual(null, f.GetPreloadedEntityBody(), "F18");
            Assert.AreEqual("http", f.GetProtocol(), "F19");
            Assert.AreEqual(null, f.GetQueryStringRawBytes(), "F20");
            Assert.AreEqual("__GetRemoteAddress", f.GetRemoteName(), "F21");
            Assert.AreEqual(0, f.GetRequestReason(), "F22");
            Assert.AreEqual("GetLocalAddress", f.GetServerName(), "F23");
            Assert.AreEqual(null, f.GetServerVariable("A"), "F24");
            Assert.AreEqual(null, f.GetUnknownRequestHeader("IAMTHEUKNOWNN"), "F25");
            Assert.AreEqual(null, f.GetUnknownRequestHeaders(), "F26");
            Assert.AreEqual(0, f.GetUrlContextID(), "F27");
            Assert.AreEqual(IntPtr.Zero, f.GetUserToken(), "F28");
            Assert.AreEqual(IntPtr.Zero, f.GetVirtualPathToken(), "F29");
            Assert.AreEqual(false, f.HasEntityBody(), "F30");
            Assert.AreEqual(true, f.HeadersSent(), "F31");
            Assert.AreEqual(true, f.IsClientConnected(), "F32");
            Assert.AreEqual(false, f.IsEntireEntityBodyIsPreloaded(), "F33");
            Assert.AreEqual(false, f.IsSecure(), "F34");

            Assert.AreEqual(0, f.ReadEntityBody(null, Int32.MaxValue), "ReadEntityBody(byte[],int)");
#if NET_2_0
            Assert.AreEqual(Guid.Empty.ToString(), f.RequestTraceIdentifier.ToString(), "RequestTraceIdentifier");
            Assert.IsNull(f.RootWebConfigPath, "RootWebConfigPath");
            Assert.AreEqual(0, f.GetPreloadedEntityBody(null, Int32.MinValue), "GetPreloadedEntityBody(byte[],int)");
            Assert.AreEqual(0, f.GetPreloadedEntityBodyLength(), "GetPreloadedEntityBodyLength");
            Assert.AreEqual(0, f.GetTotalEntityBodyLength(), "GetTotalEntityBodyLength");
            Assert.AreEqual(0, f.ReadEntityBody(null, 0, 0), "ReadEntityBody(byte[],int,int)");
#endif
        }
		[Test] public void TestDefaults ()
		{
			FakeHttpWorkerRequest f = new FakeHttpWorkerRequest ();

			Assert.AreEqual (null, f.MachineConfigPath, "F1");
			Assert.AreEqual (null, f.MapPath ("x"), "F2");
			Assert.AreEqual (null, f.MachineConfigPath, "F3");
			Assert.AreEqual (null, f.MachineInstallDirectory, "F4");
			Assert.AreEqual ("BLABA", f.GetAppPath (), "F5");
			Assert.AreEqual (null, f.GetAppPathTranslated (), "F5");
			Assert.AreEqual (null, f.GetAppPoolID (), "F6");
			Assert.AreEqual (0, f.GetBytesRead (), "F7");
			Assert.AreEqual (new byte [0], f.GetClientCertificate (), "F8");
			Assert.AreEqual (new byte [0], f.GetClientCertificateBinaryIssuer (), "F9");
			Assert.AreEqual (0, f.GetClientCertificateEncoding (), "F10");
			Assert.AreEqual (new byte [0], f.GetClientCertificatePublicKey (), "F11");

			Assert.AreEqual (0, f.GetConnectionID (), "F14");
			Assert.AreEqual (null, f.GetFilePathTranslated () , "F16");
			Assert.AreEqual ("", f.GetPathInfo () , "F17");
			Assert.AreEqual (null, f.GetPreloadedEntityBody () , "F18");
			Assert.AreEqual ("http", f.GetProtocol () , "F19");
			Assert.AreEqual (null, f.GetQueryStringRawBytes () , "F20");			
			Assert.AreEqual ("__GetRemoteAddress", f.GetRemoteName () , "F21");
			Assert.AreEqual (0, f.GetRequestReason () , "F22");
			Assert.AreEqual ("GetLocalAddress", f.GetServerName () , "F23");
			Assert.AreEqual (null, f.GetServerVariable ("A") , "F24");
			Assert.AreEqual (null, f.GetUnknownRequestHeader ("IAMTHEUKNOWNN"), "F25");
			Assert.AreEqual (null, f.GetUnknownRequestHeaders (), "F26");
			Assert.AreEqual (0, f.GetUrlContextID (), "F27");
			Assert.AreEqual (IntPtr.Zero, f.GetUserToken (), "F28");
			Assert.AreEqual (IntPtr.Zero, f.GetVirtualPathToken (), "F29");
			Assert.AreEqual (false, f.HasEntityBody (), "F30");
			Assert.AreEqual (true, f.HeadersSent (), "F31");
			Assert.AreEqual (true, f.IsClientConnected (), "F32");
			Assert.AreEqual (false, f.IsEntireEntityBodyIsPreloaded (), "F33");
			Assert.AreEqual (false, f.IsSecure (), "F34");

			Assert.AreEqual (0, f.ReadEntityBody (null, Int32.MaxValue), "ReadEntityBody(byte[],int)");
			Assert.AreEqual (Guid.Empty.ToString (), f.RequestTraceIdentifier.ToString (), "RequestTraceIdentifier");
			Assert.IsNull (f.RootWebConfigPath, "RootWebConfigPath");
			Assert.AreEqual (0, f.GetPreloadedEntityBody (null, Int32.MinValue), "GetPreloadedEntityBody(byte[],int)");
			Assert.AreEqual (0, f.GetPreloadedEntityBodyLength (), "GetPreloadedEntityBodyLength");
			Assert.AreEqual (0, f.GetTotalEntityBodyLength (), "GetTotalEntityBodyLength");
			Assert.AreEqual (0, f.ReadEntityBody (null, 0, 0), "ReadEntityBody(byte[],int,int)");
		}
        [Category("NotDotNet")]          // Cannot be runned on .net with no web context
        public void SetUp()
        {
            HttpWorkerRequest workerRequest = new FakeHttpWorkerRequest();

            context = new HttpContext(workerRequest);
        }
		[Category ("NotDotNet")] // Cannot be runned on .net with no web context
		public void SetUp()
		{
			HttpWorkerRequest workerRequest = new FakeHttpWorkerRequest();
			context = new HttpContext(workerRequest);
		}
		HttpContext Cook (int re)
		{
			FakeHttpWorkerRequest f = new FakeHttpWorkerRequest (re);
			HttpContext c = new HttpContext (f);

			return c;
		}