You've already forked linux-packaging-mono
Imported Upstream version 3.12.0
Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
@@ -317,7 +317,7 @@ namespace MonoCasTests.System.CodeDom.Compiler {
|
||||
[ExpectedException (typeof (SecurityException))]
|
||||
public void LinkDemand_IsDefinedExtension_Deny_Anything ()
|
||||
{
|
||||
MethodInfo mi = mi = typeof (CodeDomProvider).GetMethod ("IsDefinedExtension");
|
||||
MethodInfo mi = typeof (CodeDomProvider).GetMethod ("IsDefinedExtension");
|
||||
Assert.IsNotNull (mi, "IsDefinedExtension");
|
||||
Assert.IsFalse ((bool) mi.Invoke (null, new object[1] { String.Empty }), "IsDefinedExtension('')");
|
||||
// requires full trust (i.e. unrestricted permission set)
|
||||
@@ -328,7 +328,7 @@ namespace MonoCasTests.System.CodeDom.Compiler {
|
||||
[ExpectedException (typeof (SecurityException))]
|
||||
public void LinkDemand_IsDefinedLanguage_Deny_Anything ()
|
||||
{
|
||||
MethodInfo mi = mi = typeof (CodeDomProvider).GetMethod ("IsDefinedLanguage");
|
||||
MethodInfo mi = typeof (CodeDomProvider).GetMethod ("IsDefinedLanguage");
|
||||
Assert.IsNotNull (mi, "IsDefinedLanguage");
|
||||
Assert.IsFalse ((bool) mi.Invoke (null, new object[1] { String.Empty }), "IsDefinedLanguage('')");
|
||||
// requires full trust (i.e. unrestricted permission set)
|
||||
|
@@ -237,7 +237,7 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
t = Task.Factory.StartNew (() => {
|
||||
try {
|
||||
return BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token);
|
||||
} catch (OperationCanceledException WE_GOT_CANCELED) {
|
||||
} catch (OperationCanceledException) {
|
||||
res = "canceled";
|
||||
return -10;
|
||||
}
|
||||
@@ -247,6 +247,40 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
Assert.AreEqual (-10, t.Result, "#5");
|
||||
Assert.AreEqual ("canceled", res, "#6");
|
||||
}
|
||||
|
||||
[Test, ExpectedException (typeof(OperationCanceledException))]
|
||||
public void BoundedAddLimit ()
|
||||
{
|
||||
const int elNumber = 5;
|
||||
|
||||
var c = new BlockingCollection <int> (elNumber);
|
||||
var token = new CancellationTokenSource (100);
|
||||
|
||||
for (var i = 0; i < elNumber + 1; i++) {
|
||||
c.Add (1, token.Token);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddAnyCancellable ()
|
||||
{
|
||||
const int elNumber = 5;
|
||||
const int colNumber = 5;
|
||||
|
||||
var cols = new BlockingCollection <int> [colNumber];
|
||||
for (var i = 0; i < colNumber; i++) {
|
||||
cols[i] = new BlockingCollection <int> (elNumber);
|
||||
}
|
||||
|
||||
var token = new CancellationTokenSource (100);
|
||||
for (var i = 0; i < colNumber * elNumber; i++) {
|
||||
BlockingCollection <int>.AddToAny (cols, 1, token.Token);
|
||||
}
|
||||
|
||||
foreach (var col in cols) {
|
||||
Assert.AreEqual (elNumber, col.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -277,7 +277,7 @@ namespace MonoTests.System.ComponentModel.Design.Serialization {
|
||||
}
|
||||
}
|
||||
|
||||
class InstanceField
|
||||
public class InstanceField
|
||||
{
|
||||
public string Name;
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@ namespace MonoTests.System.ComponentModel
|
||||
public class CharConverterTest
|
||||
{
|
||||
private CharConverter converter;
|
||||
private string pattern;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
@@ -28,7 +27,6 @@ namespace MonoTests.System.ComponentModel
|
||||
converter = new CharConverter ();
|
||||
|
||||
DateTimeFormatInfo info = CultureInfo.CurrentCulture.DateTimeFormat;
|
||||
pattern = info.ShortDatePattern + " " + info.ShortTimePattern;
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@@ -733,10 +733,6 @@ namespace MonoTests.System.ComponentModel
|
||||
container.Add (this);
|
||||
return container;
|
||||
}
|
||||
|
||||
public Container Container {
|
||||
get { return container; }
|
||||
}
|
||||
}
|
||||
|
||||
class MyContainer : IContainer
|
||||
|
@@ -159,6 +159,30 @@ namespace MonoTests.System.Diagnostics
|
||||
ValidateExceptions ("#TAT:BadChildren", "<assert>{0}</assert>", badChildren);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")]
|
||||
public void PerformanceCountersTag ()
|
||||
{
|
||||
string[] goodAttributes = {
|
||||
"",
|
||||
"filemappingsize=\"1048576\"",
|
||||
"filemappingsize=\"0\""
|
||||
};
|
||||
ValidateSuccess ("#PCT:Good", "<performanceCounters {0}/>", goodAttributes);
|
||||
|
||||
string[] badAttributes = {
|
||||
"FileMappingSize=\"1048576\"",
|
||||
"filemappingsize=\"\"",
|
||||
"filemappingsize=\"non-int-value\""
|
||||
};
|
||||
ValidateExceptions ("#PCT:BadAttrs", "<performanceCounters {0}/>", badAttributes);
|
||||
|
||||
string[] badChildren = {
|
||||
"<any element=\"here\"/>"
|
||||
};
|
||||
ValidateExceptions ("#PCT:BadChildren", "<performanceCounters>{0}</performanceCounters>", badChildren);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")]
|
||||
public void TraceTag_Attributes ()
|
||||
|
@@ -722,7 +722,7 @@ namespace MonoTests.System.Diagnostics
|
||||
}
|
||||
}
|
||||
|
||||
int bytesRead = -1;
|
||||
public int bytesRead = -1;
|
||||
|
||||
#if NET_2_0
|
||||
// Not technically a 2.0 only test, but I use lambdas, so I need gmcs
|
||||
@@ -836,7 +836,7 @@ namespace MonoTests.System.Diagnostics
|
||||
try {
|
||||
var x = p.Handle;
|
||||
Assert.Fail ("Handle should throw for unstated procs, but returned " + x);
|
||||
} catch (InvalidOperationException ex) {
|
||||
} catch (InvalidOperationException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -31,6 +31,8 @@
|
||||
|
||||
#if !MOBILE
|
||||
|
||||
#define TRACE
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Text;
|
||||
@@ -43,11 +45,15 @@ namespace MonoTests.System.Diagnostics
|
||||
[TestFixture]
|
||||
public class SourceSwitchTest
|
||||
{
|
||||
internal TraceSource traceSource { get; set; }
|
||||
internal TestTextWriterTraceListener txtTraceListener;
|
||||
|
||||
|
||||
[Test]
|
||||
public void ConstructorNullName ()
|
||||
{
|
||||
SourceSwitch s = new SourceSwitch (null);
|
||||
Assert.IsNull (s.DisplayName);
|
||||
Assert.IsEmpty (s.DisplayName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -98,6 +104,80 @@ namespace MonoTests.System.Diagnostics
|
||||
Assert.IsTrue (s.ShouldTrace (TraceEventType.Resume), "#9");
|
||||
Assert.IsTrue (s.ShouldTrace (TraceEventType.Transfer), "#10");
|
||||
}
|
||||
|
||||
|
||||
[SetUp]
|
||||
public void InitalizeSourceSwitchTest()
|
||||
{
|
||||
// Initializing the TraceSource instance
|
||||
traceSource = new TraceSource ("LoggingTraceSource");
|
||||
traceSource.Listeners.Remove("Default");
|
||||
traceSource.Switch = new SourceSwitch ("MySwitch");
|
||||
|
||||
// Initializing the TraceListener instance
|
||||
txtTraceListener = new TestTextWriterTraceListener (Console.Out);
|
||||
traceSource.Listeners.Add (txtTraceListener);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void setSwitchToCritical()
|
||||
{
|
||||
traceSource.Switch.Level = SourceLevels.Critical;
|
||||
LogAllTraceLevels ();
|
||||
// Switch.Level is Critical so it should log Critical
|
||||
Assert.AreEqual (1, txtTraceListener.TotalMessageCount);
|
||||
Assert.AreEqual (1, txtTraceListener.CritialMessageCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void setSwitchToError()
|
||||
{
|
||||
traceSource.Switch.Level = SourceLevels.Error;
|
||||
LogAllTraceLevels ();
|
||||
// Switch.Level is Error so it should log Critical, Error
|
||||
Assert.AreEqual (2, txtTraceListener.TotalMessageCount);
|
||||
Assert.AreEqual (1, txtTraceListener.ErrorMessageCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void setSwitchToWarning()
|
||||
{
|
||||
traceSource.Switch.Level = SourceLevels.Warning;
|
||||
LogAllTraceLevels ();
|
||||
// Switch.Level is Warning so it should log Critical, Error, Warning
|
||||
Assert.AreEqual (3, txtTraceListener.TotalMessageCount);
|
||||
Assert.AreEqual (1, txtTraceListener.WarningMessageCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void setSwitchToInfo()
|
||||
{
|
||||
traceSource.Switch.Level = SourceLevels.Information;
|
||||
LogAllTraceLevels ();
|
||||
// Switch.Level is Information so it should log Critical, Error, Warning, Information
|
||||
Assert.AreEqual (4, txtTraceListener.TotalMessageCount);
|
||||
Assert.AreEqual (1, txtTraceListener.InfoMessageCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void setSwitchToVerbose()
|
||||
{
|
||||
traceSource.Switch.Level = SourceLevels.Verbose;
|
||||
LogAllTraceLevels ();
|
||||
// Switch.Level is Verbose so it should log Critical, Error, Warning, Information, Verbose
|
||||
Assert.AreEqual (5, txtTraceListener.TotalMessageCount);
|
||||
Assert.AreEqual (1, txtTraceListener.VerboseMessageCount);
|
||||
}
|
||||
|
||||
void LogAllTraceLevels ()
|
||||
{
|
||||
traceSource.TraceEvent (TraceEventType.Critical, 123, "Critical Level message.");
|
||||
traceSource.TraceEvent (TraceEventType.Error, 123, "Error Level message.");
|
||||
traceSource.TraceEvent (TraceEventType.Warning, 123, "Warning Level message.");
|
||||
traceSource.TraceEvent (TraceEventType.Information, 123, "Information Level message.");
|
||||
traceSource.TraceEvent (TraceEventType.Verbose, 123, "Verbose Level message.");
|
||||
traceSource.Flush ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -80,6 +80,12 @@ namespace MonoTests.System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
class TestNullSwitch : Switch {
|
||||
public TestNullSwitch () : base (null, null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class SwitchesTest {
|
||||
|
||||
@@ -184,8 +190,16 @@ namespace MonoTests.System.Diagnostics {
|
||||
BooleanSwitch s = new BooleanSwitch ("test", "", "hoge");
|
||||
Assert.IsTrue (!s.Enabled);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NullSwitchHasEmptyDisplayNameAndDescription ()
|
||||
{
|
||||
var s = new TestNullSwitch ();
|
||||
Assert.IsEmpty (s.DisplayName);
|
||||
Assert.IsEmpty (s.Description);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -0,0 +1,88 @@
|
||||
// TextWriterTraceListenerHelper.cs -
|
||||
// Test Helper for System.Diagnostics/SourceSwitchTest.cs
|
||||
|
||||
//
|
||||
// Author:
|
||||
// Ramtin Raji Kermani
|
||||
//
|
||||
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#if !MOBILE
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MonoTests.System.Diagnostics
|
||||
{
|
||||
public class TestTextWriterTraceListener: TextWriterTraceListener
|
||||
{
|
||||
public int TotalMessageCount { set; get;}
|
||||
public int CritialMessageCount { get; set;}
|
||||
public int ErrorMessageCount { get; set;}
|
||||
public int WarningMessageCount { get; set;}
|
||||
public int InfoMessageCount { get; set;}
|
||||
public int VerboseMessageCount { set; get;}
|
||||
|
||||
public TestTextWriterTraceListener(TextWriter textWriter): base(textWriter)
|
||||
{
|
||||
Console.WriteLine ("TextWriterTraceListener is instantiated.");
|
||||
}
|
||||
|
||||
|
||||
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message)
|
||||
{
|
||||
base.TraceEvent (eventCache, source, eventType, id, message);
|
||||
TotalMessageCount++;
|
||||
|
||||
switch (eventType) {
|
||||
case TraceEventType.Critical:
|
||||
CritialMessageCount++; break;
|
||||
case TraceEventType.Error:
|
||||
ErrorMessageCount++; break;
|
||||
case TraceEventType.Warning:
|
||||
WarningMessageCount++; break;
|
||||
case TraceEventType.Information:
|
||||
InfoMessageCount++; break;
|
||||
case TraceEventType.Verbose:
|
||||
VerboseMessageCount++; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearMessageCounters()
|
||||
{
|
||||
TotalMessageCount = 0;
|
||||
CritialMessageCount = 0;
|
||||
WarningMessageCount = 0;
|
||||
ErrorMessageCount = 0;
|
||||
InfoMessageCount = 0;
|
||||
VerboseMessageCount = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -29,7 +29,6 @@ namespace MonoCasTests.System.Net.Sockets {
|
||||
|
||||
static ManualResetEvent reset;
|
||||
private string message;
|
||||
private string uri = "http://www.google.com";
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void FixtureSetUp ()
|
||||
|
@@ -936,7 +936,7 @@ namespace MonoTests.System.Net.Sockets {
|
||||
try {
|
||||
client = new UdpClient (port);
|
||||
break;
|
||||
} catch (Exception ex) {
|
||||
} catch (Exception) {
|
||||
if (i == 5)
|
||||
throw;
|
||||
}
|
||||
|
@@ -49,7 +49,10 @@ namespace MonoTests.System.Net.WebSockets
|
||||
[Test]
|
||||
public void ServerHandshakeReturnCrapStatusCodeTest ()
|
||||
{
|
||||
// On purpose,
|
||||
#pragma warning disable 4014
|
||||
HandleHttpRequestAsync ((req, resp) => resp.StatusCode = 418);
|
||||
#pragma warning restore 4014
|
||||
try {
|
||||
Assert.IsTrue (socket.ConnectAsync (new Uri ("ws://localhost:" + Port), CancellationToken.None).Wait (5000));
|
||||
} catch (AggregateException e) {
|
||||
@@ -62,10 +65,12 @@ namespace MonoTests.System.Net.WebSockets
|
||||
[Test]
|
||||
public void ServerHandshakeReturnWrongUpgradeHeader ()
|
||||
{
|
||||
#pragma warning disable 4014
|
||||
HandleHttpRequestAsync ((req, resp) => {
|
||||
resp.StatusCode = 101;
|
||||
resp.Headers["Upgrade"] = "gtfo";
|
||||
});
|
||||
#pragma warning restore 4014
|
||||
try {
|
||||
Assert.IsTrue (socket.ConnectAsync (new Uri ("ws://localhost:" + Port), CancellationToken.None).Wait (5000));
|
||||
} catch (AggregateException e) {
|
||||
@@ -78,12 +83,14 @@ namespace MonoTests.System.Net.WebSockets
|
||||
[Test]
|
||||
public void ServerHandshakeReturnWrongConnectionHeader ()
|
||||
{
|
||||
#pragma warning disable 4014
|
||||
HandleHttpRequestAsync ((req, resp) => {
|
||||
resp.StatusCode = 101;
|
||||
resp.Headers["Upgrade"] = "websocket";
|
||||
// Mono http request doesn't like the forcing, test still valid since the default connection header value is empty
|
||||
//ForceSetHeader (resp.Headers, "Connection", "Foo");
|
||||
});
|
||||
#pragma warning restore 4014
|
||||
try {
|
||||
Assert.IsTrue (socket.ConnectAsync (new Uri ("ws://localhost:" + Port), CancellationToken.None).Wait (5000));
|
||||
} catch (AggregateException e) {
|
||||
@@ -94,6 +101,7 @@ namespace MonoTests.System.Net.WebSockets
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore ("See bug #24340")]
|
||||
public void EchoTest ()
|
||||
{
|
||||
const string Payload = "This is a websocket test";
|
||||
@@ -118,6 +126,7 @@ namespace MonoTests.System.Net.WebSockets
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore ("See bug #24340")]
|
||||
public void CloseOutputAsyncTest ()
|
||||
{
|
||||
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
|
||||
|
@@ -30,14 +30,13 @@ namespace MonoCasTests.System.Net {
|
||||
static ManualResetEvent reset;
|
||||
private string message;
|
||||
private string hostname;
|
||||
private IPAddress ip;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void FixtureSetUp ()
|
||||
{
|
||||
reset = new ManualResetEvent (false);
|
||||
hostname = Dns.GetHostName ();
|
||||
ip = Dns.Resolve (site).AddressList[0];
|
||||
var ip = Dns.Resolve (site).AddressList[0];
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
|
@@ -36,6 +36,14 @@ using NUnit.Framework;
|
||||
namespace MonoTests.System.Net {
|
||||
[TestFixture]
|
||||
public class HttpListenerTest {
|
||||
|
||||
int port;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp () {
|
||||
port = new Random ().Next (7777, 8000);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefaultProperties ()
|
||||
{
|
||||
@@ -115,7 +123,7 @@ namespace MonoTests.System.Net {
|
||||
socket.Listen(1);
|
||||
}
|
||||
}
|
||||
catch(Exception ex) {
|
||||
catch(Exception) {
|
||||
//Can be AccessDeniedException(ports 80/443 need root access) or
|
||||
//SocketException because other application is listening
|
||||
return false;
|
||||
@@ -152,10 +160,12 @@ namespace MonoTests.System.Net {
|
||||
[Test]
|
||||
public void TwoListeners_SameAddress ()
|
||||
{
|
||||
if (!CanOpenPort (port))
|
||||
Assert.Ignore ("port");
|
||||
HttpListener listener1 = new HttpListener ();
|
||||
listener1.Prefixes.Add ("http://127.0.0.1:7777/");
|
||||
listener1.Prefixes.Add ("http://127.0.0.1:" + port + "/");
|
||||
HttpListener listener2 = new HttpListener ();
|
||||
listener2.Prefixes.Add ("http://127.0.0.1:7777/hola/");
|
||||
listener2.Prefixes.Add ("http://127.0.0.1:" + port + "/hola/");
|
||||
listener1.Start ();
|
||||
listener2.Start ();
|
||||
}
|
||||
@@ -164,10 +174,12 @@ namespace MonoTests.System.Net {
|
||||
[ExpectedException (typeof (HttpListenerException))]
|
||||
public void TwoListeners_SameURL ()
|
||||
{
|
||||
if (!CanOpenPort (port))
|
||||
Assert.Ignore ("port");
|
||||
HttpListener listener1 = new HttpListener ();
|
||||
listener1.Prefixes.Add ("http://127.0.0.1:7777/hola/");
|
||||
listener1.Prefixes.Add ("http://127.0.0.1:" + port + "/hola/");
|
||||
HttpListener listener2 = new HttpListener ();
|
||||
listener2.Prefixes.Add ("http://127.0.0.1:7777/hola/");
|
||||
listener2.Prefixes.Add ("http://127.0.0.1:" + port + "/hola/");
|
||||
listener1.Start ();
|
||||
listener2.Start ();
|
||||
}
|
||||
@@ -176,8 +188,10 @@ namespace MonoTests.System.Net {
|
||||
[ExpectedException (typeof (HttpListenerException))]
|
||||
public void MultipleSlashes ()
|
||||
{
|
||||
if (!CanOpenPort (port))
|
||||
Assert.Ignore ("port");
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add ("http://localhost:7777/hola////");
|
||||
listener.Prefixes.Add ("http://localhost:" + port + "/hola////");
|
||||
// this one throws on Start(), not when adding it.
|
||||
listener.Start ();
|
||||
}
|
||||
@@ -186,8 +200,10 @@ namespace MonoTests.System.Net {
|
||||
[ExpectedException (typeof (HttpListenerException))]
|
||||
public void PercentSign ()
|
||||
{
|
||||
if (!CanOpenPort (port))
|
||||
Assert.Ignore ("port");
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add ("http://localhost:7777/hola%3E/");
|
||||
listener.Prefixes.Add ("http://localhost:" + port + "/hola%3E/");
|
||||
// this one throws on Start(), not when adding it.
|
||||
listener.Start ();
|
||||
}
|
||||
@@ -202,8 +218,10 @@ namespace MonoTests.System.Net {
|
||||
[Test]
|
||||
public void CloseTwice ()
|
||||
{
|
||||
if (!CanOpenPort (port))
|
||||
Assert.Ignore ("port");
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add ("http://localhost:7777/hola/");
|
||||
listener.Prefixes.Add ("http://localhost:" + port + "/hola/");
|
||||
listener.Start ();
|
||||
listener.Close ();
|
||||
listener.Close ();
|
||||
@@ -212,8 +230,10 @@ namespace MonoTests.System.Net {
|
||||
[Test]
|
||||
public void StartStopStart ()
|
||||
{
|
||||
if (!CanOpenPort (port))
|
||||
Assert.Ignore ("port");
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add ("http://localhost:7777/hola/");
|
||||
listener.Prefixes.Add ("http://localhost:" + port + "/hola/");
|
||||
listener.Start ();
|
||||
listener.Stop ();
|
||||
listener.Start ();
|
||||
@@ -223,8 +243,10 @@ namespace MonoTests.System.Net {
|
||||
[Test]
|
||||
public void StartStopDispose ()
|
||||
{
|
||||
if (!CanOpenPort (port))
|
||||
Assert.Ignore ("port");
|
||||
using (HttpListener listener = new HttpListener ()){
|
||||
listener.Prefixes.Add ("http://localhost:7777/hola/");
|
||||
listener.Prefixes.Add ("http://localhost:" + port + "/hola/");
|
||||
listener.Start ();
|
||||
listener.Stop ();
|
||||
}
|
||||
@@ -240,8 +262,10 @@ namespace MonoTests.System.Net {
|
||||
[Test]
|
||||
public void AbortTwice ()
|
||||
{
|
||||
if (!CanOpenPort (port))
|
||||
Assert.Ignore ("port");
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add ("http://localhost:7777/hola/");
|
||||
listener.Prefixes.Add ("http://localhost:" + port + "/hola/");
|
||||
listener.Start ();
|
||||
listener.Abort ();
|
||||
listener.Abort ();
|
||||
|
@@ -31,7 +31,7 @@ using System.Net;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MoonTest.System.Net {
|
||||
namespace MonoTests.System.Net {
|
||||
|
||||
[TestFixture]
|
||||
public class NetworkCredentialTest {
|
||||
|
@@ -2221,6 +2221,28 @@ namespace MonoTests.System.Net
|
||||
webClient.UploadFileAsync (uri, "PUT", tempFile);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UploadFileAsyncContentType ()
|
||||
{
|
||||
var serverUri = "http://localhost:13370/";
|
||||
var filename = Path.GetTempFileName ();
|
||||
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add (serverUri);
|
||||
listener.Start ();
|
||||
|
||||
using (var client = new WebClient ())
|
||||
{
|
||||
client.UploadFileTaskAsync (new Uri (serverUri), filename);
|
||||
var request = listener.GetContext ().Request;
|
||||
|
||||
var expected = "multipart/form-data; boundary=------------";
|
||||
Assert.AreEqual (expected.Length + 15, request.ContentType.Length);
|
||||
Assert.AreEqual (expected, request.ContentType.Substring (0, expected.Length));
|
||||
}
|
||||
listener.Close ();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_4_0
|
||||
|
@@ -52,6 +52,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
|
||||
private static byte[] cert_a_issuer_raw = new byte[] { 0x30, 0x5F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x17, 0x52, 0x53, 0x41, 0x20, 0x44, 0x61, 0x74, 0x61, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x2E, 0x30, 0x2C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x25, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x43, 0x65,
|
||||
0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79 };
|
||||
|
||||
#if false
|
||||
private static byte[] cert_b = { 0x30,0x82,0x03,0x04,0x30,0x82,0x02,0xC4,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x03,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x30,0x51,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x31,0x0C,0x30,0x0A,0x06,0x03,0x55,0x04,0x0B,0x13,0x03,0x44,0x6F,0x44,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x03,0x13,0x11,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,
|
||||
0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x30,0x30,0x31,0x30,0x32,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x30,0x33,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x51,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x31,0x0C,0x30,0x0A,0x06,0x03,0x55,0x04,0x0B,0x13,0x03,0x44,0x6F,0x44,0x31,0x1A,0x30,0x18,
|
||||
0x06,0x03,0x55,0x04,0x03,0x13,0x11,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x30,0x82,0x01,0xB6,0x30,0x82,0x01,0x2B,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x01,0x30,0x82,0x01,0x1E,0x02,0x81,0x81,0x00,0x90,0x89,0x3E,0x18,0x1B,0xFE,0xA3,0x1D,0x16,0x89,0x00,0xB4,0xD5,0x40,0x82,0x4C,0x2E,0xEC,0x3D,0x66,0x0D,0x0D,0xB9,0x17,0x40,0x6E,0x3A,0x5C,0x03,0x7B,0x1B,0x93,0x28,0x0C,0xEF,0xB9,0x97,0xE3,0xA1,0xEB,0xE2,0xA3,0x7C,0x61,0xDD,0x6F,0xD5,0xAD,0x15,0x69,0x00,
|
||||
@@ -60,6 +61,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
|
||||
0x54,0x4B,0xC0,0xA8,0x40,0xEF,0x71,0xE8,0x56,0x6B,0xA2,0x29,0xCB,0x1E,0x09,0x7D,0x27,0x39,0x91,0x3B,0x20,0x4F,0x98,0x39,0xE8,0x39,0xCA,0x98,0xC5,0xAF,0x54,0x03,0x81,0x84,0x00,0x02,0x81,0x80,0x54,0xA8,0x88,0xB5,0x8F,0x01,0x56,0xCE,0x18,0x8F,0xA6,0xD6,0x7C,0x29,0x29,0x75,0x45,0xE8,0x31,0xA4,0x07,0x17,0xED,0x1E,0x5D,0xB2,0x7B,0xBB,0xCE,0x3C,0x97,0x67,0x1E,0x88,0x0A,0xFE,0x7D,0x00,0x22,0x27,0x1D,0x66,0xEE,0xF6,0x1B,0xB6,0x95,0x7F,0x5A,0xFF,0x06,0x34,0x02,0x43,0xC3,0x83,0xC4,0x66,0x2C,0xA1,0x05,0x0E,
|
||||
0x68,0xB3,0xCA,0xDC,0xD3,0xF9,0x0C,0xC0,0x66,0xDF,0x85,0x84,0x4B,0x20,0x5D,0x41,0xAC,0xC0,0xEC,0x37,0x92,0x0E,0x97,0x19,0xBF,0x53,0x35,0x63,0x27,0x18,0x33,0x35,0x42,0x4D,0xF0,0x2D,0x6D,0xA7,0xA4,0x98,0xAA,0x57,0xF3,0xD2,0xB8,0x6E,0x4E,0x8F,0xFF,0xBE,0x6F,0x4E,0x0F,0x0B,0x44,0x24,0xEE,0xDF,0x4C,0x22,0x5B,0x44,0x98,0x94,0xCB,0xB8,0xA3,0x2F,0x30,0x2D,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x9D,0x2D,0x73,0xC3,0xB8,0xE3,0x4D,0x29,0x28,0xC3,0x65,0xBE,0xA9,0x98,0xCB,0xD6,0x8A,0x06,0x68,
|
||||
0x9C,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x03,0x2F,0x00,0x30,0x2C,0x02,0x14,0x5A,0x1B,0x2D,0x08,0x0E,0xE6,0x99,0x38,0x8F,0xB5,0x09,0xC9,0x89,0x79,0x7E,0x01,0x30,0xBD,0xCE,0xF0,0x02,0x14,0x71,0x7B,0x08,0x51,0x97,0xCE,0x4D,0x1F,0x6A,0x84,0x47,0x3A,0xC0,0xBD,0x13,0x89,0x81,0xB9,0x01,0x97 };
|
||||
#endif
|
||||
|
||||
static public byte[] RFC3280MandatoryAttributeTypesCACert_crt = { 0x30, 0x82, 0x02, 0xC1, 0x30, 0x82, 0x02, 0x2A, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x60, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x40, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x1A, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x11, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0C, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x41, 0x6E, 0x63, 0x68, 0x6F, 0x72, 0x30, 0x1E, 0x17, 0x0D,
|
||||
0x30, 0x31, 0x30, 0x34, 0x31, 0x39, 0x31, 0x34, 0x35, 0x37, 0x32, 0x30, 0x5A, 0x17, 0x0D, 0x31, 0x31, 0x30, 0x34, 0x31, 0x39, 0x31, 0x34, 0x35, 0x37, 0x32, 0x30, 0x5A, 0x30, 0x81, 0x8E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x1A, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x11, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x31, 0x13, 0x30, 0x11, 0x06, 0x0A, 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x19, 0x16, 0x03, 0x67, 0x6F, 0x76, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x0A, 0x09,
|
||||
@@ -82,13 +84,13 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
|
||||
static public AsnEncodedData emptyData = new AsnEncodedData (new byte[0]);
|
||||
|
||||
private X509Certificate2 x509a;
|
||||
private X509Certificate2 x509b;
|
||||
//private X509Certificate2 x509b;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void FixtureSetUp ()
|
||||
{
|
||||
x509a = new X509Certificate2 (cert_a);
|
||||
x509b = new X509Certificate2 (cert_b);
|
||||
//x509b = new X509Certificate2 (cert_b);
|
||||
}
|
||||
|
||||
private void Empty (X500DistinguishedName dn)
|
||||
|
@@ -41,7 +41,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
|
||||
[TestFixture]
|
||||
public class X509ChainTest {
|
||||
|
||||
private X509Certificate2Collection empty;
|
||||
//private X509Certificate2Collection empty;
|
||||
private X509Certificate2Collection collection;
|
||||
|
||||
private X509Certificate2 cert_empty;
|
||||
@@ -56,7 +56,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
|
||||
cert1 = new X509Certificate2 (X509Certificate2Test.farscape_pfx, "farscape", X509KeyStorageFlags.Exportable);
|
||||
cert2 = new X509Certificate2 (Encoding.ASCII.GetBytes (X509Certificate2Test.base64_cert));
|
||||
|
||||
empty = new X509Certificate2Collection ();
|
||||
//empty = new X509Certificate2Collection ();
|
||||
collection = new X509Certificate2Collection ();
|
||||
collection.Add (cert1);
|
||||
collection.Add (cert2);
|
||||
|
@@ -22,7 +22,7 @@ namespace MonoTests.System.Text.RegularExpressions
|
||||
try {
|
||||
result = Regex.Replace (original, pattern, replacement);
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (Exception) {
|
||||
result = "Error.";
|
||||
}
|
||||
Assert.AreEqual (expected, result, "rr#: {0} ~ s,{1},{2},",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user