}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test1 ()
{
var port = NetworkHelpers.FindFreePort ();
Send (ns, "GET / HTTP/1.1\r\n\r\n"); // No host
string response = Receive (ns, 512);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 400", response);
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 400"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test2 ()
{
var port = NetworkHelpers.FindFreePort ();
Send (ns, "GET / HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n"); // no prefix
string response = Receive (ns, 512);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 400", response);
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 400"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test3 ()
{
StringBuilder bad = new StringBuilder ();
string response = Receive (ns, 512);
ns.Close ();
listener.Close ();
- StringAssert.StartsWith ("HTTP/1.1 400", response, String.Format ("Failed on {0}", (int) b));
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 400"), String.Format ("Failed on {0}", (int) b));
}
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test4 ()
{
var port = NetworkHelpers.FindFreePort ();
Send (ns, "POST /test4/ HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n"); // length required
string response = Receive (ns, 512);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 411", response);
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 411"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test5 ()
{
var port = NetworkHelpers.FindFreePort ();
Send (ns, "POST / HTTP/1.1\r\nHost: 127.0.0.1\r\nTransfer-Encoding: pepe\r\n\r\n"); // not implemented
string response = Receive (ns, 512);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 501", response);
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 501"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test6 ()
{
var port = NetworkHelpers.FindFreePort ();
Send (ns, "POST /test6/ HTTP/1.1\r\nHost: 127.0.0.1\r\nTransfer-Encoding: identity\r\n\r\n");
string response = Receive (ns, 512);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 501", response);
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 501"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test7 ()
{
var port = NetworkHelpers.FindFreePort ();
ctx.Response.Close ();
string response = Receive (ns, 1024);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 200", response);
- StringAssert.Contains ("Transfer-Encoding: chunked", response);
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 200"));
+ Assert.IsTrue(response.Contains ("Transfer-Encoding: chunked"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test8 ()
{
var port = NetworkHelpers.FindFreePort ();
ctx.Response.Close ();
string response = Receive (ns, 512);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 200", response);
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 200"));
Assert.IsTrue (-1 == response.IndexOf ("Transfer-Encoding: chunked"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test9 ()
{
var port = NetworkHelpers.FindFreePort ();
string response = ReceiveWithTimeout (ns, 512, 1000, out timeout);
ns.Close ();
Assert.IsFalse (timeout);
- StringAssert.StartsWith ("HTTP/1.1 411", response);
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 411"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test10 ()
{
var port = NetworkHelpers.FindFreePort ();
string response = ReceiveWithTimeout (ns, 512, 1000, out timeout);
ns.Close ();
Assert.IsFalse (timeout);
- StringAssert.StartsWith ("HTTP/1.1 411", response);
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 411"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test11 ()
{
var port = NetworkHelpers.FindFreePort ();
ns.GetSocket ().Shutdown (SocketShutdown.Send);
string input = Receive (ns, 512);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 400", input);
+ Assert.IsTrue(input.StartsWith ("HTTP/1.1 400"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test12 ()
{
var port = NetworkHelpers.FindFreePort ();
ns.GetSocket ().Shutdown (SocketShutdown.Send);
string input = Receive (ns, 512);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 400", input);
+ Assert.IsTrue(input.StartsWith ("HTTP/1.1 400"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test13 ()
{
var port = NetworkHelpers.FindFreePort ();
ns.GetSocket ().Shutdown (SocketShutdown.Send);
string input = Receive (ns, 512);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 400", input);
+ Assert.IsTrue(input.StartsWith ("HTTP/1.1 400"));
}
HttpListenerRequest test14_request;
ManualResetEvent test_evt;
bool test14_error;
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test14 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test15 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test16 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test17 ()
{
var port = NetworkHelpers.FindFreePort ();
ctx.Response.Close ();
string response = Receive (ns, 1024);
ns.Close ();
- StringAssert.StartsWith ("HTTP/1.1 200", response);
- StringAssert.Contains ("Transfer-Encoding: chunked", response);
+ Assert.IsTrue(response.StartsWith ("HTTP/1.1 200"));
+ Assert.IsTrue(response.Contains ("Transfer-Encoding: chunked"));
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test_MultipleClosesOnOuputStreamAllowed ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveCookiesFromClient ()
{
sendCookiePort = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SendCookiestoClient ()
{
receiveCookiePort = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void MultiResponses ()
{
echoServerPort = NetworkHelpers.FindFreePort ();
[TestFixture]
public class HttpListenerBugs {
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestNonChunkedAsync ()
{
var port = NetworkHelpers.FindFreePort ();
// a documented pattern to close the connection
//
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test_MultipleConnections ()
{
var port = NetworkHelpers.FindFreePort ();
// Test case for bug 341443, an pretty old bug, filed on November of 2007.
//
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test_HostInUri ()
{
var wait = new ManualResetEvent (false);
}
[Test] // bug #513849
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ClosePort ()
{
var port = NetworkHelpers.FindFreePort ();
// does not also listen to another interface.
//
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BindToSingleInterface ()
{
IPAddress [] machineAddress = null;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BindToAllInterfaces ()
{
var h = new HttpListener ();
// Test case for bug #31209
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test_EmptyLineAtStart ()
{
var port = NetworkHelpers.FindFreePort ();