You've already forked linux-packaging-mono
Imported Upstream version 5.12.0.220
Former-commit-id: c477e03582759447177c6d4bf412cd2355aad476
This commit is contained in:
parent
8bd104cef2
commit
8fc30896db
@@ -194,6 +194,7 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MultiThreaded")]
|
||||
public void TakeAnyFromSecondCollection ()
|
||||
{
|
||||
var a = new BlockingCollection<string> ();
|
||||
@@ -213,6 +214,7 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MultiThreaded")]
|
||||
public void TakeAnyCancellable ()
|
||||
{
|
||||
var a = new BlockingCollection<string> ();
|
||||
|
@@ -68,6 +68,7 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MultiThreaded")]
|
||||
public void BasicAddTakeFromOtherThread ()
|
||||
{
|
||||
var t = new Thread (() => bag.Add (1));
|
||||
@@ -88,6 +89,7 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MultiThreaded")]
|
||||
public void AddFromMultipleThreadTakeFromOneThread ()
|
||||
{
|
||||
var threads = new Thread[10];
|
||||
@@ -115,6 +117,7 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MultiThreaded")]
|
||||
public void AddFromOneThreadTakeFromMultiple ()
|
||||
{
|
||||
var threads = new Thread[10];
|
||||
@@ -152,6 +155,7 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MultiThreaded")]
|
||||
public void BasicAddPeekFromOtherThread ()
|
||||
{
|
||||
var t = new Thread (() => bag.Add (1));
|
||||
@@ -168,6 +172,7 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MultiThreaded")]
|
||||
public void AddFromOneThreadPeekFromMultiple ()
|
||||
{
|
||||
var threads = new Thread[10];
|
||||
|
@@ -164,6 +164,31 @@ namespace MonoTests.System.Configuration {
|
||||
[TestFixture]
|
||||
public class ApplicationSettingsBaseTest
|
||||
{
|
||||
string tempDir;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void FixtureSetup ()
|
||||
{
|
||||
// Use random temp directory to store settings files of tests.
|
||||
tempDir = Path.Combine (Path.GetTempPath (), Path.GetRandomFileName ());
|
||||
Directory.CreateDirectory (tempDir);
|
||||
var localAppData = Path.Combine (tempDir, "LocalAppData");
|
||||
Directory.CreateDirectory (localAppData);
|
||||
var appData = Path.Combine (tempDir, "AppData");
|
||||
Directory.CreateDirectory (appData);
|
||||
|
||||
Environment.SetEnvironmentVariable ("XDG_DATA_HOME", localAppData);
|
||||
Environment.SetEnvironmentVariable ("XDG_CONFIG_HOME", appData);
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void FixtureTearDown ()
|
||||
{
|
||||
Environment.SetEnvironmentVariable ("XDG_DATA_HOME", null);
|
||||
Environment.SetEnvironmentVariable ("XDG_CONFIG_HOME", null);
|
||||
Directory.Delete (tempDir, true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSettings1_Properties ()
|
||||
{
|
||||
@@ -522,6 +547,212 @@ namespace MonoTests.System.Configuration {
|
||||
Assert.Fail ("Invalid data was saved to config file.");
|
||||
}
|
||||
}
|
||||
#region Bug #2315
|
||||
class Bug2315Settings : ApplicationSettingsBase
|
||||
{
|
||||
public Bug2315Settings () : base ("Bug2315Settings")
|
||||
{
|
||||
}
|
||||
|
||||
[UserScopedSetting]
|
||||
[DefaultSettingValue ("some text")]
|
||||
public string Text {
|
||||
get { return (string)this ["Text"]; }
|
||||
set { this ["Text"] = value; }
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SettingSavingEventFired_Bug2315 ()
|
||||
{
|
||||
bool settingsSavingCalled = false;
|
||||
var settings = new Bug2315Settings ();
|
||||
settings.SettingsSaving += (object sender, CancelEventArgs e) => {
|
||||
settingsSavingCalled = true;
|
||||
};
|
||||
|
||||
settings.Text = DateTime.Now.ToString ();
|
||||
settings.Save ();
|
||||
|
||||
Assert.IsTrue (settingsSavingCalled);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Bug #15818
|
||||
class Bug15818SettingsProvider: SettingsProvider, IApplicationSettingsProvider
|
||||
{
|
||||
public Bug15818SettingsProvider ()
|
||||
{
|
||||
}
|
||||
|
||||
public static void ResetUpgradeCalled ()
|
||||
{
|
||||
UpgradeCalled = false;
|
||||
}
|
||||
|
||||
public static bool UpgradeCalled { get; private set; }
|
||||
|
||||
public override void Initialize (string name, NameValueCollection config)
|
||||
{
|
||||
if (name != null && config != null) {
|
||||
base.Initialize (name, config);
|
||||
}
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return "Bug15818SettingsProvider"; }
|
||||
}
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get { return "Bug15818SettingsProvider"; }
|
||||
}
|
||||
|
||||
public override string ApplicationName
|
||||
{
|
||||
get { return "Bug15818"; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override SettingsPropertyValueCollection GetPropertyValues (SettingsContext context, SettingsPropertyCollection collection)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void SetPropertyValues (SettingsContext context, SettingsPropertyValueCollection collection)
|
||||
{
|
||||
}
|
||||
|
||||
#region IApplicationSettingsProvider implementation
|
||||
|
||||
public SettingsPropertyValue GetPreviousVersion (SettingsContext context, SettingsProperty property)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Reset (SettingsContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public void Upgrade (SettingsContext context, SettingsPropertyCollection properties)
|
||||
{
|
||||
UpgradeCalled = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
class Bug15818Settings : ApplicationSettingsBase
|
||||
{
|
||||
public Bug15818Settings () : base ("Bug15818Settings")
|
||||
{
|
||||
}
|
||||
|
||||
[UserScopedSetting]
|
||||
[SettingsProvider (typeof (Bug15818SettingsProvider))]
|
||||
[DefaultSettingValue ("some text")]
|
||||
public string Text {
|
||||
get { return (string)this ["Text"]; }
|
||||
set { this ["Text"] = value; }
|
||||
}
|
||||
}
|
||||
|
||||
public class Bug15818Class
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Value { get; set; }
|
||||
}
|
||||
|
||||
class Bug15818Settings2 : ApplicationSettingsBase
|
||||
{
|
||||
public Bug15818Settings2 () : base ("Bug15818Settings2")
|
||||
{
|
||||
}
|
||||
|
||||
[UserScopedSetting]
|
||||
[DefaultSettingValue ("default text")]
|
||||
public string Text {
|
||||
get { return (string)this ["Text"]; }
|
||||
set { this ["Text"] = value; }
|
||||
}
|
||||
|
||||
[UserScopedSetting]
|
||||
public Bug15818Class MyObject {
|
||||
get { return (Bug15818Class)this ["MyObject"]; }
|
||||
set { this ["MyObject"] = value; }
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpgradeGetsCalled_Bug15818 ()
|
||||
{
|
||||
Bug15818SettingsProvider.ResetUpgradeCalled ();
|
||||
|
||||
var settings = new Bug15818Settings ();
|
||||
settings.Upgrade ();
|
||||
Assert.IsTrue (Bug15818SettingsProvider.UpgradeCalled);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CustomClass_Roundtrip ()
|
||||
{
|
||||
var settings = new Bug15818Settings2
|
||||
{
|
||||
Text = "foo",
|
||||
MyObject = new Bug15818Class { Name = "Some Name", Value = 15818 }
|
||||
};
|
||||
settings.Save ();
|
||||
|
||||
var settings2 = new Bug15818Settings2 ();
|
||||
Assert.AreEqual ("foo", settings2.Text);
|
||||
Assert.IsNotNull (settings2.MyObject);
|
||||
Assert.AreEqual ("Some Name", settings2.MyObject.Name);
|
||||
Assert.AreEqual (15818, settings2.MyObject.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ModifiedObjectsAreSerialized_Bug15818 ()
|
||||
{
|
||||
var settings = new Bug15818Settings2
|
||||
{
|
||||
Text = "foo",
|
||||
MyObject = new Bug15818Class { Name = "Some Name", Value = 15818 }
|
||||
};
|
||||
settings.Save ();
|
||||
|
||||
// Modify the value of the object - bug #15818
|
||||
settings.Text = "bla";
|
||||
settings.MyObject.Name = "xyz";
|
||||
settings.MyObject.Value = -1;
|
||||
settings.Save ();
|
||||
|
||||
// Verify that the new values got saved
|
||||
var settings2 = new Bug15818Settings2 ();
|
||||
Assert.AreEqual ("bla", settings2.Text);
|
||||
Assert.IsNotNull (settings2.MyObject);
|
||||
Assert.AreEqual ("xyz", settings2.MyObject.Name);
|
||||
Assert.AreEqual (-1, settings2.MyObject.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Reset_FiresPropChangedOnly_Bug15818 ()
|
||||
{
|
||||
bool propChangedCalled = false;
|
||||
bool settingsLoadedCalled = false;
|
||||
bool settingsSavingCalled = false;
|
||||
var settings = new Bug15818Settings2 ();
|
||||
settings.PropertyChanged += (sender, e) => { propChangedCalled = true; };
|
||||
settings.SettingsLoaded += (sender, e) => { settingsLoadedCalled = true; };
|
||||
settings.SettingsSaving += (sender, e) => { settingsSavingCalled = true; };
|
||||
|
||||
settings.Reset ();
|
||||
|
||||
Assert.IsTrue (propChangedCalled, "#1");
|
||||
Assert.IsFalse (settingsLoadedCalled, "#2");
|
||||
Assert.IsFalse (settingsSavingCalled, "#3");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -81,6 +81,28 @@ namespace MonoTests.System.Configuration {
|
||||
Assert.AreEqual ("<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<int>7</int>", ((string)v.SerializedValue).Replace ("\r\n", "\n"), "A13");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Properties_ChangeSerialzeAs ()
|
||||
{
|
||||
SettingsProperty p = new SettingsProperty ("property",
|
||||
typeof (int),
|
||||
null,
|
||||
true,
|
||||
10,
|
||||
SettingsSerializeAs.String,
|
||||
null,
|
||||
true,
|
||||
false);
|
||||
|
||||
SettingsPropertyValue v = new SettingsPropertyValue (p);
|
||||
|
||||
// test that setting SerializeAs after changing v.PropertyValue causes
|
||||
// SerializedValue to be in the new format
|
||||
v.PropertyValue = (object)5;
|
||||
p.SerializeAs = SettingsSerializeAs.Xml;
|
||||
Assert.AreEqual ("<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<int>5</int>", ((string)v.SerializedValue).Replace("\r\n", "\n"), "A99");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Dirty ()
|
||||
{
|
||||
@@ -221,6 +243,29 @@ namespace MonoTests.System.Configuration {
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This tests the case where we have a SerializedValue but not a PropertyValue.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Xml_SerializeNoPropValue ()
|
||||
{
|
||||
SettingsProperty p = new SettingsProperty ("property",
|
||||
typeof (MyData),
|
||||
null,
|
||||
true,
|
||||
10,
|
||||
SettingsSerializeAs.Xml,
|
||||
null,
|
||||
true,
|
||||
false);
|
||||
|
||||
SettingsPropertyValue v = new SettingsPropertyValue (p);
|
||||
v.SerializedValue = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<int>10</int>";
|
||||
|
||||
Assert.AreEqual ("<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<int>10</int>", v.SerializedValue);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Binary_Serialize ()
|
||||
{
|
||||
|
@@ -98,6 +98,7 @@ namespace MonoTests.System.Net.Sockets
|
||||
|
||||
[Test]
|
||||
[Category("Test")]
|
||||
[Category("MultiThreaded")]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
|
@@ -1 +1 @@
|
||||
d1bb2ffee7ac63a76151854a3bc57ec5d6a2a70a
|
||||
1e25aea1bb2838df06140728a614e421211c3ab8
|
@@ -49,7 +49,10 @@ namespace MonoTests.System.Net.Sockets
|
||||
}
|
||||
}
|
||||
|
||||
// make sure the connection arrives
|
||||
// There is no guarantee that the connecting socket will be in the listener's
|
||||
// accept queue yet (though it is highly likely on Linux). We wait up to one
|
||||
// second for the connecting socket to enter the listener's accept queue.
|
||||
Assert.IsTrue (inListener.Server.Poll (1000, SelectMode.SelectRead));
|
||||
Assert.IsTrue (inListener.Pending ());
|
||||
Socket inSock = inListener.AcceptSocket ();
|
||||
|
||||
|
@@ -55,6 +55,7 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MultiThreaded")]
|
||||
public void Async ()
|
||||
{
|
||||
WebResponse res = null;
|
||||
@@ -463,6 +464,7 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MultiThreaded")]
|
||||
public void GetRequestStream_File_Exists ()
|
||||
{
|
||||
Stream s = File.Create (_tempFile);
|
||||
|
@@ -185,6 +185,7 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MultiThreaded")]
|
||||
public void ResponseUri ()
|
||||
{
|
||||
FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
|
||||
|
@@ -1 +1 @@
|
||||
4cabb0ca84eac14cc074c0d4c57ee60a33f65cad
|
||||
a0154e7ba83fa85a9caed000fd90aa90d75ae63b
|
@@ -875,7 +875,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2");
|
||||
Assert.IsNull (ex.InnerException, "#A3");
|
||||
Assert.IsNotNull (ex.Message, "#A4");
|
||||
Assert.AreEqual ("size", ex.ParamName, "#A5");
|
||||
Assert.AreEqual ("count", ex.ParamName, "#A5");
|
||||
}
|
||||
|
||||
// read full response
|
||||
@@ -890,7 +890,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2");
|
||||
Assert.IsNull (ex.InnerException, "#B3");
|
||||
Assert.IsNotNull (ex.Message, "#B4");
|
||||
Assert.AreEqual ("size", ex.ParamName, "#B5");
|
||||
Assert.AreEqual ("count", ex.ParamName, "#B5");
|
||||
}
|
||||
} finally {
|
||||
rs.Close ();
|
||||
@@ -928,7 +928,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2");
|
||||
Assert.IsNull (ex.InnerException, "#A3");
|
||||
Assert.IsNotNull (ex.Message, "#A4");
|
||||
Assert.AreEqual ("size", ex.ParamName, "#A5");
|
||||
Assert.AreEqual ("count", ex.ParamName, "#A5");
|
||||
}
|
||||
|
||||
// read full response
|
||||
@@ -943,7 +943,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2");
|
||||
Assert.IsNull (ex.InnerException, "#B3");
|
||||
Assert.IsNotNull (ex.Message, "#B4");
|
||||
Assert.AreEqual ("size", ex.ParamName, "#B5");
|
||||
Assert.AreEqual ("count", ex.ParamName, "#B5");
|
||||
}
|
||||
} finally {
|
||||
rs.Close ();
|
||||
@@ -1221,6 +1221,7 @@ namespace MonoTests.System.Net
|
||||
|
||||
[Test]
|
||||
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
|
||||
[Category ("MobileNotWorking")] // https://github.com/xamarin/xamarin-macios/issues/3827
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
|
@@ -23,25 +23,6 @@ namespace MonoTests.System.Net
|
||||
[TestFixture]
|
||||
public class WebClientTest
|
||||
{
|
||||
private string _tempFolder;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
_tempFolder = Path.Combine (Path.GetTempPath (),
|
||||
GetType ().FullName);
|
||||
if (Directory.Exists (_tempFolder))
|
||||
Directory.Delete (_tempFolder, true);
|
||||
Directory.CreateDirectory (_tempFolder);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown ()
|
||||
{
|
||||
if (Directory.Exists (_tempFolder))
|
||||
Directory.Delete (_tempFolder, true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (WebException))] // Something catches the PlatformNotSupportedException and re-throws an WebException
|
||||
@@ -842,8 +823,7 @@ namespace MonoTests.System.Net
|
||||
[Test] // UploadFile (string, string)
|
||||
public void UploadFile1_Address_Null ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
File.Create (tempFile).Close ();
|
||||
string tempFile = Path.GetTempFileName ();
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -855,14 +835,16 @@ namespace MonoTests.System.Net
|
||||
Assert.IsNotNull (ex.Message, "#4");
|
||||
Assert.IsNotNull (ex.ParamName, "#5");
|
||||
Assert.AreEqual ("address", ex.ParamName, "#6");
|
||||
} finally {
|
||||
if (File.Exists (tempFile))
|
||||
File.Delete (tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
[Test] // UploadFile (string, string)
|
||||
public void UploadFile1_Address_SchemeNotSupported ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
File.Create (tempFile).Close ();
|
||||
string tempFile = Path.GetTempFileName ();
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -882,13 +864,17 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (NotSupportedException), inner.GetType (), "#7");
|
||||
Assert.IsNull (inner.InnerException, "#8");
|
||||
Assert.IsNotNull (inner.Message, "#9");
|
||||
} finally {
|
||||
if (File.Exists (tempFile))
|
||||
File.Delete (tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
[Test] // UploadFile (string, string)
|
||||
public void UploadFile1_FileName_NotFound ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
var tempPath = Path.GetTempPath ();
|
||||
string tempFile = Path.Combine (tempPath, Path.GetRandomFileName ());
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -934,7 +920,7 @@ namespace MonoTests.System.Net
|
||||
[Test] // UploadFile (Uri, string)
|
||||
public void UploadFile2_Address_Null ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
string tempFile = Path.GetRandomFileName ();
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -952,8 +938,7 @@ namespace MonoTests.System.Net
|
||||
[Test] // UploadFile (Uri, string)
|
||||
public void UploadFile2_Address_SchemeNotSupported ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
File.Create (tempFile).Close ();
|
||||
string tempFile = Path.GetTempFileName ();
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -973,13 +958,17 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (NotSupportedException), inner.GetType (), "#7");
|
||||
Assert.IsNull (inner.InnerException, "#8");
|
||||
Assert.IsNotNull (inner.Message, "#9");
|
||||
} finally {
|
||||
if (File.Exists (tempFile))
|
||||
File.Delete (tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
[Test] // UploadFile (Uri, string)
|
||||
public void UploadFile2_FileName_NotFound ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
var tempPath = Path.GetTempPath ();
|
||||
string tempFile = Path.Combine (tempPath, Path.GetRandomFileName ());
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -1025,8 +1014,7 @@ namespace MonoTests.System.Net
|
||||
[Test] // UploadFile (string, string, string)
|
||||
public void UploadFile3_Address_Null ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
File.Create (tempFile).Close ();
|
||||
string tempFile = Path.GetRandomFileName ();
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -1037,15 +1025,14 @@ namespace MonoTests.System.Net
|
||||
Assert.IsNull (ex.InnerException, "#3");
|
||||
Assert.IsNotNull (ex.Message, "#4");
|
||||
Assert.IsNotNull (ex.ParamName, "#5");
|
||||
Assert.AreEqual ("path", ex.ParamName, "#6");
|
||||
Assert.AreEqual ("address", ex.ParamName, "#6");
|
||||
}
|
||||
}
|
||||
|
||||
[Test] // UploadFile (string, string, string)
|
||||
public void UploadFile3_Address_SchemeNotSupported ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
File.Create (tempFile).Close ();
|
||||
string tempFile = Path.GetTempFileName ();
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -1065,13 +1052,17 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (NotSupportedException), inner.GetType (), "#7");
|
||||
Assert.IsNull (inner.InnerException, "#8");
|
||||
Assert.IsNotNull (inner.Message, "#9");
|
||||
} finally {
|
||||
if (File.Exists (tempFile))
|
||||
File.Delete (tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
[Test] // UploadFile (string, string, string)
|
||||
public void UploadFile3_FileName_NotFound ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
var tempPath = Path.GetTempPath ();
|
||||
string tempFile = Path.Combine (tempPath, Path.GetRandomFileName ());
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -1117,7 +1108,7 @@ namespace MonoTests.System.Net
|
||||
[Test] // UploadFile (Uri, string, string)
|
||||
public void UploadFile4_Address_Null ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
string tempFile = Path.GetRandomFileName ();
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -1135,8 +1126,7 @@ namespace MonoTests.System.Net
|
||||
[Test] // UploadFile (Uri, string, string)
|
||||
public void UploadFile4_Address_SchemeNotSupported ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
File.Create (tempFile).Close ();
|
||||
string tempFile = Path.GetTempFileName ();
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -1156,13 +1146,17 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (NotSupportedException), inner.GetType (), "#7");
|
||||
Assert.IsNull (inner.InnerException, "#8");
|
||||
Assert.IsNotNull (inner.Message, "#9");
|
||||
} finally {
|
||||
if (File.Exists (tempFile))
|
||||
File.Delete (tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
[Test] // UploadFile (Uri, string, string)
|
||||
public void UploadFile4_FileName_NotFound ()
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
var tempPath = Path.GetTempPath ();
|
||||
string tempFile = Path.Combine (tempPath, Path.GetRandomFileName ());
|
||||
|
||||
WebClient wc = new WebClient ();
|
||||
try {
|
||||
@@ -1691,6 +1685,7 @@ namespace MonoTests.System.Net
|
||||
// We throw a PlatformNotSupportedException deeper, which is caught and re-thrown as WebException
|
||||
[ExpectedException (typeof (WebException))]
|
||||
#endif
|
||||
[Category ("MobileNotWorking")] // https://github.com/xamarin/xamarin-macios/issues/3827
|
||||
[Category ("InetAccess")]
|
||||
public void GetWebRequestOverriding ()
|
||||
{
|
||||
@@ -1874,8 +1869,7 @@ namespace MonoTests.System.Net
|
||||
{
|
||||
UploadAsyncCancelEventTest (9304,(webClient, uri, cancelEvent) =>
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
File.Create (tempFile).Close ();
|
||||
string tempFile = Path.GetTempFileName ();
|
||||
|
||||
webClient.UploadFileCompleted += (sender, args) =>
|
||||
{
|
||||
|
@@ -1 +1 @@
|
||||
a7e48646d05dcf3b87af070d4ee4cb66ac045634
|
||||
58b7b1819107b4116d60ac04a1f27d5b8af4a0d7
|
68
mcs/class/System/Test/System.Threading/WaitHandleTests.cs
Normal file
68
mcs/class/System/Test/System.Threading/WaitHandleTests.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Security.AccessControl;
|
||||
using System.Threading;
|
||||
|
||||
namespace MonoTests.System.Threading {
|
||||
[TestFixture]
|
||||
public class WaitHandleTests {
|
||||
SynchronizationContext OriginalContext;
|
||||
TestSynchronizationContext TestContext;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
OriginalContext = SynchronizationContext.Current;
|
||||
TestContext = new TestSynchronizationContext();
|
||||
TestContext.SetWaitNotificationRequired();
|
||||
SynchronizationContext.SetSynchronizationContext(TestContext);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown ()
|
||||
{
|
||||
SynchronizationContext.SetSynchronizationContext(OriginalContext);
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if MONODROID
|
||||
[Ignore("https://github.com/mono/mono/issues/8349")]
|
||||
#endif
|
||||
public void WaitHandle_WaitOne_SynchronizationContext ()
|
||||
{
|
||||
var e = new ManualResetEvent(false);
|
||||
TestContext.WaitAction = () => e.Set();
|
||||
Assert.IsTrue(e.WaitOne(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WaitHandle_WaitAll_SynchronizationContext ()
|
||||
{
|
||||
var e1 = new ManualResetEvent(false);
|
||||
var e2 = new ManualResetEvent(false);
|
||||
TestContext.WaitAction = () => {
|
||||
e1.Set();
|
||||
e2.Set();
|
||||
};
|
||||
Assert.IsTrue(WaitHandle.WaitAll(new[] { e1, e2 }, 0));
|
||||
}
|
||||
}
|
||||
|
||||
class TestSynchronizationContext : SynchronizationContext
|
||||
{
|
||||
public Action WaitAction { get; set; }
|
||||
|
||||
public new void SetWaitNotificationRequired ()
|
||||
{
|
||||
base.SetWaitNotificationRequired();
|
||||
}
|
||||
|
||||
public override int Wait (IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
|
||||
{
|
||||
WaitAction?.Invoke();
|
||||
return base.Wait(waitHandles, waitAll, millisecondsTimeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user