Imported Upstream version 5.18.0.142

Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-09 08:20:59 +00:00
parent e52655b4dc
commit 0abdbe5a7d
1547 changed files with 93792 additions and 47893 deletions

View File

@@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System
{
public static partial class AdminHelpers
{
public unsafe static bool IsProcessElevated() => true;
}
}

View File

@@ -0,0 +1,26 @@
namespace System.Net.Test.Common
{
public static partial class Configuration
{
public static partial class Http
{
static Http ()
{
var echoServers = new object[] { RemoteEchoServer };
var secureEchoServers = new object[] { SecureRemoteEchoServer };
if (PlatformDetection.IsWindows) {
EchoServers = new object[][] { echoServers };
} else {
EchoServers = new object[][] { echoServers, secureEchoServers };
}
}
public static readonly object[][] EchoServers;
// public static readonly object[][] VerifyUploadServers = { new object[] { RemoteVerifyUploadServer }, new object[] { SecureRemoteVerifyUploadServer } };
// public static readonly object[][] CompressedServers = { new object[] { RemoteDeflateServer }, new object[] { RemoteGZipServer } };
// public static readonly object[][] Http2Servers = { new object[] { new Uri ("https://" + Http2Host) } };
// public static readonly object[][] Http2NoPushServers = { new object[] { new Uri ("https://" + Http2NoPushHost) } };
}
}
}

View File

@@ -0,0 +1,147 @@
using System.IO;
using System.Collections;
using NUnit.Framework.Constraints;
namespace NUnit.Framework
{
static class CollectionAssert
{
public static void DoesNotContain (IEnumerable collection, object val)
{
Assert.That(collection, Has.No.Member(val));
}
public static void Contains (IEnumerable collection, object val)
{
Assert.That(collection, Has.Member(val));
}
public static void AreEqual (IEnumerable expected, IEnumerable actual, string message = null, params object[] args)
{
Assert.That(actual, Is.EqualTo(expected), message, args);
}
public static void AreEquivalent (IEnumerable expected, IEnumerable actual, string message = null, params object[] args)
{
Assert.That(actual, Is.EquivalentTo(expected), message, args);
}
public static void IsEmpty(IEnumerable collection, string message = null, params object[] args)
{
Assert.That(collection, new EmptyCollectionConstraint(), message, args);
}
public static void IsNotEmpty(IEnumerable collection, string message = null, params object[] args)
{
Assert.That(collection, Is.Not.Empty, message, args);
}
}
static class FileAssert
{
public static void AreEqual(Stream expected, Stream actual, string message, params object[] args)
{
Assert.That(actual, Is.EqualTo(expected), message, args);
}
public static void AreEqual(string expected, string actual, string message, params object[] args)
{
using (FileStream exStream = File.OpenRead(expected))
using (FileStream acStream = File.OpenRead(actual))
{
AreEqual(exStream, acStream, message, args);
}
}
}
static class StringAssert
{
public static void Contains(string expected, string actual, string message = null, params object[] args)
{
Assert.That(actual, Is.StringContaining (expected), message, args);
}
public static void StartsWith(string expected, string actual, string message = null, params object[] args)
{
Assert.IsTrue (actual.StartsWith (expected), message, args);
}
}
static class AssertHelper
{
public static void IsEmpty (string aString, string message = null, params object[] args )
{
Assert.That(aString, Is.Empty, message, args);
}
public static void IsNotEmpty (string aString, string message = null, params object[] args )
{
Assert.That(aString, Is.Not.Empty, message, args);
}
public static void Less(int arg1, int arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.LessThan(arg2), message, args);
}
public static void Greater(int arg1, int arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.GreaterThan(arg2), message, args);
}
public static void Greater(double arg1, double arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.GreaterThan(arg2), message, args);
}
public static void Greater(System.DateTime arg1, System.DateTime arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.GreaterThan(arg2), message, args);
}
public static void GreaterOrEqual(int arg1, int arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
}
public static void GreaterOrEqual(long arg1, long arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
}
public static void GreaterOrEqual(System.DateTime arg1, System.DateTime arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
}
public static void GreaterOrEqual(System.TimeSpan arg1, System.TimeSpan arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
}
public static void LessOrEqual (int arg1, int arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
}
public static void LessOrEqual(long arg1, long arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
}
public static void LessOrEqual(System.DateTime arg1, System.DateTime arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
}
public static void LessOrEqual(System.TimeSpan arg1, System.TimeSpan arg2, string message = null, params object[] args)
{
Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
}
public static void IsNotInstanceOfType(System.Type expected, object actual, string message, params object[] args )
{
Assert.IsFalse (actual.GetType ().IsInstanceOfType (expected), message, args);
}
}
}

View File

@@ -0,0 +1,36 @@
namespace System
{
static partial class PlatformDetection
{
public static readonly bool IsNetNative = false;
public static readonly bool IsNotWinRT = true;
public static readonly bool IsWinRT = false;
public static readonly bool IsWindowsNanoServer = false;
public static readonly bool IsNotWindowsNanoServer = true;
public static readonly bool IsNotWindowsServerCore = true;
public static bool IsWindows7 => false;
public static bool IsFullFramework => false;
public static bool IsNonZeroLowerBoundArraySupported => true;
public static bool IsUap => false;
//TODO: check?
public static bool IsNotWindowsSubsystemForLinux => true;
public static bool IsWindowsSubsystemForLinux => false;
public static bool IsFedora => false;
public static bool IsRedHatFamily => false;
public static bool IsOpenSUSE => false;
public static bool IsUbuntu1404 => false;
public static bool IsNotRedHatFamily6 => true;
public static bool IsNetfx462OrNewer => false;
public static bool IsWindows {
get {
PlatformID id = Environment.OSVersion.Platform;
return id == PlatformID.Win32Windows || id == PlatformID.Win32NT;
}
}
public static bool IsInAppContainer => false;
}
}

View File

@@ -0,0 +1,24 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Reflection;
using System.Text;
using System.IO;
namespace System.Diagnostics
{
// this file can be used in order to ignore all RemoteInvoke-tests
// should be used instead of /corefx/.../RemoteExecutorTestBase.Process.cs
public abstract partial class RemoteExecutorTestBase : FileCleanupTestBase
{
static RemoteInvokeHandle RemoteInvoke (MethodInfo method, string[] args,
RemoteInvokeOptions options, bool pasteArguments = true)
{
options = options ?? new RemoteInvokeOptions ();
//do nothing. Or we can invoke the method in the same process instead:
//method.Invoke(Activator.CreateInstance(method.DeclaringType), args.OfType<object>().ToArray());
return new RemoteInvokeHandle (null, null);
}
}
}

View File

@@ -0,0 +1,19 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.IO;
using System.Runtime.InteropServices;
namespace System.Diagnostics
{
/// <summary>Base class used for all tests that need to spawn a remote process.</summary>
public abstract partial class RemoteExecutorTestBase : FileCleanupTestBase
{
// protected static readonly string HostRunnerName = "mono";
protected static readonly string HostRunner = Process.GetCurrentProcess().MainModule.FileName;
// Should be ../lib/$(PROFILE)/RemoteExecutorConsoleApp.exe
static readonly string ExtraParameter = "--debug " + Environment.GetEnvironmentVariable ("REMOTE_EXECUTOR");
}
}