Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -41,7 +41,6 @@ namespace MonoTests.System.Diagnostics
[TestFixture]
public class DelimitedListTraceListenerTest
{
#if NET_2_0
string sample1 = "sample\n";
string sample2 = ";Error;4;;;;;;;;\n";
@@ -134,8 +133,7 @@ namespace MonoTests.System.Diagnostics
x.Close ();
Assert.AreEqual (sample7, sw.ToString ().Replace ("\r\n", "\n"));
}
#endif
}
}
#endif
#endif

View File

@@ -92,22 +92,6 @@ namespace MonoTests.System.Diagnostics
"<add />",
"<add name=\"a\"/>",
"<add value=\"b\"/>",
#if !NET_2_0
// in the 2.0 profile, we currently allow non-integral
// values
//
// MS actually introduced new configuration classes
// for the 2.0 profile and did not modify the original
// classes
//
// Once we add 2.0 configuration classes for
// system.diagnostics, the origina behavior should
// be restored and this test should be enabled again
// for the 2.0 profile
// non-integral value
"<add name=\"string-value\" value=\"string-value\"/>",
#endif
// too many arguments
"<add name=\"a\" value=\"b\" extra=\"c\"/>",
// wrong casing
@@ -247,10 +231,6 @@ namespace MonoTests.System.Diagnostics
"<remove/>",
"<add/>",
"<remove name=\"foo\" extra=\"arg\"/>",
#if NET_2_0 // type is optional (it could indicate a named listener)
#else
"<add name=\"foo\"/>",
#endif
"<add type=\"foo\"/>",
"<add name=\"foo\" type=\"invalid-type\"/>",
};

View File

@@ -48,11 +48,7 @@ namespace MonoTests.System.Diagnostics {
Assert.AreEqual (a.ToString (), a.TypeId.ToString (), "TypeId");
Assert.IsFalse (a.Unrestricted, "Unrestricted");
Assert.AreEqual (".", a.MachineName, "MachineName");
#if NET_2_0
Assert.AreEqual (EventLogPermissionAccess.Write, a.PermissionAccess, "PermissionAccess");
#else
Assert.AreEqual (EventLogPermissionAccess.Browse, a.PermissionAccess, "PermissionAccess");
#endif
EventLogPermission sp = (EventLogPermission)a.CreatePermission ();
Assert.IsFalse (sp.IsUnrestricted (), "IsUnrestricted");
}
@@ -134,9 +130,7 @@ namespace MonoTests.System.Diagnostics {
case 13:
case 32:
case 92:
#if NET_2_0
case 133:
#endif
case 160:
// known invalid chars
break;
@@ -162,12 +156,10 @@ namespace MonoTests.System.Diagnostics {
Assert.AreEqual (EventLogPermissionAccess.Instrument, a.PermissionAccess, "Instrument");
a.PermissionAccess = EventLogPermissionAccess.None;
Assert.AreEqual (EventLogPermissionAccess.None, a.PermissionAccess, "None");
#if NET_2_0
a.PermissionAccess = EventLogPermissionAccess.Administer;
Assert.AreEqual (EventLogPermissionAccess.Administer, a.PermissionAccess, "Administer");
a.PermissionAccess = EventLogPermissionAccess.Write;
Assert.AreEqual (EventLogPermissionAccess.Write, a.PermissionAccess, "Write");
#endif
}
[Test]
@@ -196,4 +188,4 @@ namespace MonoTests.System.Diagnostics {
}
}
#endif
#endif

View File

@@ -45,10 +45,8 @@ namespace MonoTests.System.Diagnostics {
EventLogPermissionAccess.Browse,
EventLogPermissionAccess.Instrument,
EventLogPermissionAccess.Audit,
#if NET_2_0
EventLogPermissionAccess.Write,
EventLogPermissionAccess.Administer,
#endif
};
[Test]
@@ -90,9 +88,7 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void PermissionState_Bad ()
{
PermissionState ps = (PermissionState)77;
@@ -235,11 +231,7 @@ namespace MonoTests.System.Diagnostics {
public void IsSubset_Null ()
{
EventLogPermission elp = new EventLogPermission (PermissionState.None);
#if NET_2_0
Assert.IsTrue (elp.IsSubsetOf (null), "null");
#else
Assert.IsFalse (elp.IsSubsetOf (null), "null");
#endif
}
[Test]
@@ -359,12 +351,7 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentNullException))]
#else
// Problem inherited from ResourcePermissionBase
[ExpectedException (typeof (NullReferenceException))]
#endif
public void FromXml_Null ()
{
EventLogPermission elp = new EventLogPermission (PermissionState.None);
@@ -372,9 +359,7 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void FromXml_WrongTag ()
{
EventLogPermission elp = new EventLogPermission (PermissionState.None);
@@ -386,9 +371,7 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void FromXml_WrongTagCase ()
{
EventLogPermission elp = new EventLogPermission (PermissionState.None);

View File

@@ -1 +1 @@
5c3d08bf5c4684c4f2c90c048c1fef8512a7d147
706bfcdac0c6fa51f6b9a8017e213e59719b12e1

View File

@@ -1 +1 @@
ac3d3bc555ee25f2f10f85c3e5c729682a4173b2
668e863b5cc055feed1a132c8bc42e8fb00e586f

View File

@@ -49,11 +49,7 @@ namespace MonoTests.System.Diagnostics {
Assert.IsFalse (a.Unrestricted, "Unrestricted");
Assert.AreEqual (".", a.MachineName, "MachineName");
Assert.AreEqual ("*", a.CategoryName, "CategoryName");
#if NET_2_0
Assert.AreEqual (PerformanceCounterPermissionAccess.Write, a.PermissionAccess, "PermissionAccess");
#else
Assert.AreEqual (PerformanceCounterPermissionAccess.Browse, a.PermissionAccess, "PermissionAccess");
#endif
PerformanceCounterPermission sp = (PerformanceCounterPermission)a.CreatePermission ();
Assert.IsFalse (sp.IsUnrestricted (), "IsUnrestricted");
}
@@ -151,9 +147,7 @@ namespace MonoTests.System.Diagnostics {
case 13:
case 32:
case 92:
#if NET_2_0
case 133:
#endif
case 160:
// known invalid chars
break;
@@ -179,12 +173,10 @@ namespace MonoTests.System.Diagnostics {
Assert.AreEqual (PerformanceCounterPermissionAccess.Instrument, a.PermissionAccess, "Instrument");
a.PermissionAccess = PerformanceCounterPermissionAccess.None;
Assert.AreEqual (PerformanceCounterPermissionAccess.None, a.PermissionAccess, "None");
#if NET_2_0
a.PermissionAccess = PerformanceCounterPermissionAccess.Read;
Assert.AreEqual (PerformanceCounterPermissionAccess.Read, a.PermissionAccess, "Read");
a.PermissionAccess = PerformanceCounterPermissionAccess.Write;
Assert.AreEqual (PerformanceCounterPermissionAccess.Write, a.PermissionAccess, "Write");
#endif
}
[Test]
@@ -213,4 +205,4 @@ namespace MonoTests.System.Diagnostics {
}
}
#endif
#endif

View File

@@ -43,10 +43,8 @@ namespace MonoTests.System.Diagnostics {
static PerformanceCounterPermissionAccess[] AllAccess = {
PerformanceCounterPermissionAccess.None,
PerformanceCounterPermissionAccess.Browse,
#if NET_2_0
PerformanceCounterPermissionAccess.Read,
PerformanceCounterPermissionAccess.Write,
#endif
PerformanceCounterPermissionAccess.Instrument,
PerformanceCounterPermissionAccess.Administer,
};
@@ -90,9 +88,7 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void PermissionState_Bad ()
{
PermissionState ps = (PermissionState)77;
@@ -108,11 +104,7 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentNullException))]
#else
[ExpectedException (typeof (ArgumentException))]
#endif
public void Constructor_MachineName_Null ()
{
PerformanceCounterPermission pcp = new PerformanceCounterPermission (PerformanceCounterPermissionAccess.None, null, String.Empty);
@@ -126,9 +118,7 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void PerformanceCounterPermissionAccesss_Bad ()
{
PerformanceCounterPermissionAccess pcpa = (PerformanceCounterPermissionAccess)Int32.MinValue;
@@ -249,11 +239,7 @@ namespace MonoTests.System.Diagnostics {
public void IsSubset_Null ()
{
PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None);
#if NET_2_0
Assert.IsTrue (pcp.IsSubsetOf (null), "null");
#else
Assert.IsFalse (pcp.IsSubsetOf (null), "null");
#endif
}
[Test]
@@ -372,12 +358,7 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentNullException))]
#else
// Problem inherited from ResourcePermissionBase
[ExpectedException (typeof (NullReferenceException))]
#endif
public void FromXml_Null ()
{
PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None);
@@ -385,9 +366,7 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void FromXml_WrongTag ()
{
PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None);
@@ -399,9 +378,7 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void FromXml_WrongTagCase ()
{
PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None);

View File

@@ -20,14 +20,19 @@ namespace MonoTests.System.Diagnostics
public class ProcessStartInfoTest
{
[Test]
public void NullWorkingDirectory ()
public void NotNullCommonProperties ()
{
ProcessStartInfo info = new ProcessStartInfo ();
info.WorkingDirectory = null;
Assert.AreEqual (info.WorkingDirectory, String.Empty, "#1");
// Force FileName and Arguments to null. The others are null by default.
ProcessStartInfo info = new ProcessStartInfo (null, null);
Assert.AreEqual (info.Arguments, String.Empty, "#1");
Assert.AreEqual (info.Domain, String.Empty, "#2");
Assert.AreEqual (info.FileName, String.Empty, "#3");
Assert.AreEqual (info.UserName, String.Empty, "#4");
Assert.AreEqual (info.Verb, String.Empty, "#5");
Assert.AreEqual (info.WorkingDirectory, String.Empty, "#6");
}
#if NET_2_0
[Test]
public void StandardErrorOutputEncoding ()
{
@@ -55,6 +60,5 @@ namespace MonoTests.System.Diagnostics
info.StandardOutputEncoding = Encoding.UTF8;
Process.Start (info);
}
#endif
}
}

View File

@@ -593,7 +593,6 @@ namespace MonoTests.System.Diagnostics
}
}
#if NET_2_0
[Test]
public void Start_UseShellExecuteWithEmptyUserName ()
{
@@ -629,7 +628,6 @@ namespace MonoTests.System.Diagnostics
} catch (Win32Exception) {
}
}
#endif
[Test] // Start (string, string)
public void Start4_FileName_Null ()
@@ -724,7 +722,6 @@ namespace MonoTests.System.Diagnostics
public int bytesRead = -1;
#if NET_2_0
// Not technically a 2.0 only test, but I use lambdas, so I need gmcs
[Test]
@@ -827,7 +824,6 @@ namespace MonoTests.System.Diagnostics
Assert.IsNull (e.InnerException, "IOE inner exception should be null");
}
#endif
[Test]
public void Handle_ThrowsOnNotStarted ()
@@ -839,5 +835,10 @@ namespace MonoTests.System.Diagnostics
} catch (InvalidOperationException) {
}
}
[Test]
public void HasExitedCurrent () {
Assert.IsFalse (Process.GetCurrentProcess ().HasExited);
}
}
}

View File

@@ -6,7 +6,6 @@
//
// Copyright (C) 2006 Novell, Inc.
//
#if NET_2_0
using System;
using System.Diagnostics;
using System.Threading;
@@ -47,4 +46,3 @@ namespace MonoTests.System.Diagnostics
}
}
}
#endif

View File

@@ -48,12 +48,10 @@ namespace MonoTests.System.Diagnostics {
}
}
#if NET_2_0
public string [] ExposeSupportedAttributes ()
{
return GetSupportedAttributes ();
}
#endif
public bool Validate ()
{
@@ -146,16 +144,13 @@ namespace MonoTests.System.Diagnostics {
}
[Test]
#if NET_2_0
[Ignore ("this test depends on 1.x configuration type")]
#endif
public void NewSwitch ()
{
Assert.AreEqual ("42", tns.TestValue, "#NS:TestValue");
Assert.IsTrue (tns.Validate(), "#NS:Validate");
}
#if NET_2_0
[Test]
public void GetSupportedAttributes ()
{
@@ -198,7 +193,6 @@ namespace MonoTests.System.Diagnostics {
Assert.IsEmpty (s.DisplayName);
Assert.IsEmpty (s.Description);
}
#endif
}
}

View File

@@ -41,7 +41,6 @@ namespace MonoTests.System.Diagnostics
[TestFixture]
public class TraceListenerTest
{
#if NET_2_0
[Test]
public void GetSupportedAttributes ()
{
@@ -119,15 +118,12 @@ bulldog Transfer: 0 : hoge, relatedActivityId=00000000-0000-0000-0000-0000000000
", date.ToString ("o"), time); // date and time are in current culture
Assert.AreEqual (expected, sw.ToString ().Replace ("\r\n", "\n"));
}
#endif
class MyTraceListener : TraceListener
{
#if NET_2_0
public string [] SupportedAttributes {
get { return base.GetSupportedAttributes (); }
}
#endif
public override void Write (string message)
{
@@ -140,4 +136,4 @@ bulldog Transfer: 0 : hoge, relatedActivityId=00000000-0000-0000-0000-0000000000
}
}
#endif
#endif

View File

@@ -42,7 +42,6 @@ namespace MonoTests.System.Diagnostics
[TestFixture]
public class XmlWriterTraceListenerTest
{
#if NET_2_0
string sample1 = @"<E2ETraceEvent xmlns='http://schemas.microsoft.com/2004/06/E2ETraceEvent'><System xmlns='http://schemas.microsoft.com/2004/06/windows/eventlog/system'><EventID>0</EventID><Type>3</Type><SubType Name='Information'>0</SubType><Level>8</Level><TimeCreated SystemTime='2007-04-19T21:18:30.6250000+09:00' /><Source Name='Trace' /><Correlation ActivityID='{00000000-0000-0000-0000-000000000000}' /><Execution ProcessName='zzz' ProcessID='4776' ThreadID='1' /><Channel/><Computer>PC</Computer></System><ApplicationData>sample</ApplicationData></E2ETraceEvent>";
string sample2 = @"<E2ETraceEvent xmlns='http://schemas.microsoft.com/2004/06/E2ETraceEvent'><System xmlns='http://schemas.microsoft.com/2004/06/windows/eventlog/system'><EventID>4</EventID><Type>3</Type><SubType Name='Error'>0</SubType><Level>2</Level><TimeCreated SystemTime='2007-04-19T21:18:30.6250000+09:00' /><Source Name='' /><Correlation ActivityID='{00000000-0000-0000-0000-000000000000}' /><Execution ProcessName='zzz' ProcessID='4776' ThreadID='1' /><Channel/><Computer>PC</Computer></System><ApplicationData></ApplicationData></E2ETraceEvent>";
@@ -154,8 +153,7 @@ namespace MonoTests.System.Diagnostics
Assert.IsTrue (sw.ToString ().IndexOf (xml) > 0, "#1");
Assert.IsTrue (sw.ToString ().IndexOf ("</DataItem><DataItem>") > 0, "#2");
}
#endif
}
}
#endif
#endif