[TestFixtureSetUp]
public void Setup ()
{
+#if !FEATURE_NO_BSD_SOCKETS
ServicePointManager.Expect100Continue = false;
+#endif
rand.NextBytes (data64KB);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Proxy_Null ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
[Test]
[Category("InetAccess")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Sync ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AddRange ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
}
[Test] // bug #471782
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CloseRequestStreamAfterReadingResponse ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
#endif
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Missing_ContentEncoding ()
{
ServicePointManager.CertificatePolicy = new AcceptAllPolicy ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BadServer_ChunkedClose ()
{
// The server will send a chunked response without a 'last-chunked' mark
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStream_Body_NotAllowed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #465613
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStream_NoBuffering ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStream_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetResponse_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void EndGetRequestStream_AsyncResult_Null ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void EndGetResponse_AsyncResult_Null ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #429200
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetRequestStream ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetRequestStream_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetResponse_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #324300
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AllowAutoRedirect ()
{
IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PostAndRedirect_NoCL ()
{
IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PostAndRedirect_CL ()
{
IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PostAnd401 ()
{
IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #513087
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NonStandardVerb ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
internal void LaunchWebRequest ()
{
- var req = (HttpWebRequest) WebRequest.Create (url_to_test);
- req.Timeout = TimeOutInMilliSeconds;
-
- Start = DateTime.Now;
try {
+ var req = (HttpWebRequest) WebRequest.Create (url_to_test);
+ req.Timeout = TimeOutInMilliSeconds;
+
+ Start = DateTime.Now;
using (var resp = (HttpWebResponse) req.GetResponse ())
{
var sr = new StreamReader (resp.GetResponseStream (), Encoding.UTF8);
}
[Test] // 1st possible case of https://bugzilla.novell.com/show_bug.cgi?id=MONO74177
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestTimeoutPropertyWithServerThatExistsAndRespondsButTooLate ()
{
var ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // 2nd possible case of https://bugzilla.novell.com/show_bug.cgi?id=MONO74177
+ [Category ("RequiresBSDSockets")] // Requires some test refactoring to assert that a PlatformNotSupportedException is thrown, so don't bother (there's plenty of other tests asserting the PlatformNotSupported exceptions).
public void TestTimeoutWithEndpointThatDoesntExistThrowsConnectFailureBeforeTimeout ()
{
string url = "http://127.0.0.1:8271/"; // some endpoint that is unlikely to exist
return Encoding.UTF8.GetBytes (sw.ToString ());
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NtlmAuthentication ()
{
NtlmServer server = new NtlmServer ();
Where = "first write";
StreamWriter writer = new StreamWriter (ns, Encoding.ASCII);
writer.Write ( "HTTP/1.1 401 Unauthorized\r\n" +
- "WWW-Authenticate: NTLM\r\n" +
+ "WWW-Authenticate: ignore\r\n" +
+ "WWW-Authenticate: NTLM\r\n" +
+ "WWW-Authenticate: ignore,K\r\n" +
"Content-Length: 5\r\n\r\nWRONG");
writer.Flush ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStream ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStreamNoClose ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStreamCancelIfNotAllBytesWritten ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetRequestStream2 ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetRequestStreamNotAllBytesWritten ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetRequestStreamTimeout ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginWrite ()
{
byte[] received = new byte[data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginWriteAfterAbort ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PrematureStreamCloseAborts ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write ()
{
byte [] received = new byte [data64KB.Length];
**/
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Read ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadTimeout2 ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadServerAborted ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetResponse2 ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetResponseAborts ()
{
ManualResetEvent aborted = new ManualResetEvent(false);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestLargeDataReading ()
{
int near2GBStartPosition = rand.Next (int.MaxValue - 500, int.MaxValue);
completed [1] = new ManualResetEvent (false);
using (ListenerScope scope = new ListenerScope (processor, port, completed [0])) {
- ManualResetEvent clientCompleted = new ManualResetEvent (false);
Uri address = new Uri (string.Format ("http://localhost:{0}", port));
HttpWebRequest client = (HttpWebRequest) WebRequest.Create (address);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentNullException))]
+#endif
public void NullHost ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NoHost ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentException))]
+#endif
public void EmptyHost ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void HostAndPort ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com:80");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PortRange ()
{
for (int i = 0; i < 65536; i++) {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentException))]
+#endif
public void PortBelow ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentException))]
+#endif
public void PortAbove ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentException))]
+#endif
public void HostTooLong ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NoDate ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UtcDate ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AddAndRemoveDate ()
{
// Neil Armstrong set his foot on Moon
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
// Bug #12393
public void TestIPv6Host ()
{
}
}
-#if NET_4_5
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AllowReadStreamBuffering ()
{
var hr = WebRequest.CreateHttp ("http://www.google.com");
} catch (InvalidOperationException) {
}
}
-#endif
class ListenerScope : IDisposable {
EventWaitHandle completed;
#endif
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CookieContainerTest ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
public class HttpRequestStreamTest
{
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginRead ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanRead ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanSeek ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #324182
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanTimeout ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanWrite ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Read ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadByte ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadTimeout ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Seek ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Buffer_Null ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Count_Negative ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Count_Overflow ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Offset_Negative ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Offset_Overflow ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void WriteByte_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void WriteTimeout ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
// Bug6737
// This test is supposed to fail prior to .NET 4.0
public void Post_EmptyRequestStream ()