You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -1 +1 @@
|
||||
048091d2d7cb9dbb624836c4833bfa52d79b89cc
|
||||
bef88b0c599515481b21854be4e0073c3fea3617
|
@@ -978,7 +978,7 @@ namespace MonoTests.System.IO
|
||||
public void LastAccessTimeUtc ()
|
||||
{
|
||||
DirectoryInfo info = new DirectoryInfo (TempFolder);
|
||||
info.LastAccessTimeUtc = DateTime.Now;
|
||||
info.LastAccessTimeUtc = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -992,7 +992,7 @@ namespace MonoTests.System.IO
|
||||
public void CreationTimeUtc ()
|
||||
{
|
||||
DirectoryInfo info = new DirectoryInfo (TempFolder);
|
||||
info.CreationTimeUtc = DateTime.Now;
|
||||
info.CreationTimeUtc = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
96
mcs/class/corlib/Test/System.IO/DriveInfoTest.cs
Normal file
96
mcs/class/corlib/Test/System.IO/DriveInfoTest.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// DriveInfoTest.cs - NUnit Test Cases for System.IO.DriveInfo class
|
||||
//
|
||||
// Authors
|
||||
// Alexander Köplinger <alkpli@microsoft.com>
|
||||
//
|
||||
// Copyright (c) 2017 Xamarin, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.IO
|
||||
{
|
||||
[TestFixture]
|
||||
public class DriveInfoTest
|
||||
{
|
||||
[Test]
|
||||
public void Constructor ()
|
||||
{
|
||||
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
|
||||
Assert.Ignore ("The Jenkins builders don't have '/' mounted, just testing Windows for now.");
|
||||
|
||||
var drive = new DriveInfo ("C:\\");
|
||||
ValidateDriveInfo (drive);
|
||||
Assert.AreEqual (DriveType.Fixed, drive.DriveType);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConstructorThrowsOnNonExistingDrive ()
|
||||
{
|
||||
Assert.Throws<ArgumentException> (() => new DriveInfo ("/monodriveinfotest"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetDrivesNotEmpty ()
|
||||
{
|
||||
var drives = DriveInfo.GetDrives ();
|
||||
CollectionAssert.IsNotEmpty (drives);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetDrivesValidInfo ()
|
||||
{
|
||||
var drives = DriveInfo.GetDrives ();
|
||||
|
||||
foreach (var d in drives) {
|
||||
ValidateDriveInfo (d);
|
||||
}
|
||||
}
|
||||
|
||||
void ValidateDriveInfo (DriveInfo d)
|
||||
{
|
||||
AssertHelper.IsNotEmpty (d.Name);
|
||||
AssertHelper.IsNotEmpty (d.VolumeLabel);
|
||||
Assert.NotNull (d.RootDirectory);
|
||||
|
||||
if (d.DriveFormat != null) {
|
||||
Assert.AreNotEqual ("", d.DriveFormat);
|
||||
Assert.AreNotEqual (DriveType.Unknown, d.DriveType, "DriveFormat=" + d.DriveFormat);
|
||||
}
|
||||
|
||||
if (d.DriveType == DriveType.Fixed) { // just consider fixed drives for now
|
||||
Assert.True (d.IsReady);
|
||||
AssertHelper.GreaterOrEqual (d.AvailableFreeSpace, 0);
|
||||
AssertHelper.GreaterOrEqual (d.TotalFreeSpace, 0);
|
||||
AssertHelper.GreaterOrEqual (d.TotalSize, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -532,6 +532,12 @@ namespace MonoTests.System.IO
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Delete_NonExisting_NoException ()
|
||||
{
|
||||
File.Delete (Path.Combine (Directory.GetDirectoryRoot (Directory.GetCurrentDirectory ()), "monononexistingfile.dat"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAttributes_Archive ()
|
||||
{
|
||||
@@ -2703,8 +2709,10 @@ namespace MonoTests.System.IO
|
||||
File.Delete (path2);
|
||||
|
||||
try {
|
||||
symlink (path1, path2);
|
||||
symlink (path2, path1);
|
||||
if (symlink (path1, path2) != 0)
|
||||
Assert.Fail ("symlink #1 failed with errno={0}", Marshal.GetLastWin32Error ());
|
||||
if (symlink (path2, path1) != 0)
|
||||
Assert.Fail ("symlink #2 failed with errno={0}", Marshal.GetLastWin32Error ());
|
||||
|
||||
Assert.IsTrue (File.Exists (path1), "File.Exists must return true for path1 symlink loop");
|
||||
Assert.IsTrue (File.Exists (path2), "File.Exists must return true for path2 symlink loop");
|
||||
|
@@ -195,23 +195,20 @@ public class ConstructorBuilderTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=341439
|
||||
public void DefineParameter_Position_Zero ()
|
||||
{
|
||||
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=341439
|
||||
// https://msdn.microsoft.com/en-us/library/system.reflection.emit.constructorbuilder.defineparameter(v=vs.110).aspx
|
||||
// "If you specify 0 (zero) for iSequence, this method returns
|
||||
// a ParameterBuilder instead of throwing an exception. There
|
||||
// is nothing useful that you can do with this
|
||||
// ParameterBuilder."
|
||||
|
||||
ConstructorBuilder cb = genClass.DefineConstructor (
|
||||
0, 0, new Type [2] { typeof (int), typeof (int) });
|
||||
|
||||
try {
|
||||
cb.DefineParameter (0, ParameterAttributes.In, "param1");
|
||||
Assert.Fail ("#1");
|
||||
} catch (ArgumentOutOfRangeException ex) {
|
||||
// Specified argument was out of the range of valid values
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
|
||||
Assert.IsNull (ex.ActualValue, "#3");
|
||||
Assert.IsNull (ex.InnerException, "#4");
|
||||
Assert.IsNotNull (ex.Message, "#5");
|
||||
Assert.IsNotNull (ex.ParamName, "#6");
|
||||
}
|
||||
var pb = cb.DefineParameter (0, ParameterAttributes.In, "param1");
|
||||
Assert.IsNotNull (pb);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@@ -610,6 +610,102 @@ namespace MonoTests.System.Reflection.Emit
|
||||
invoke (444);
|
||||
}
|
||||
|
||||
static Func<int> EmitDelegate (DynamicMethod dm) {
|
||||
ILGenerator il = dm.GetILGenerator ();
|
||||
var ret_val = il.DeclareLocal (typeof (int));
|
||||
var leave_label = il.DefineLabel ();
|
||||
|
||||
//ret = 1;
|
||||
il.Emit (OpCodes.Ldc_I4, 1);
|
||||
il.Emit (OpCodes.Stloc, ret_val);
|
||||
|
||||
// try {
|
||||
il.BeginExceptionBlock ();
|
||||
// throw "hello";
|
||||
il.Emit (OpCodes.Ldstr, "hello");
|
||||
il.Emit (OpCodes.Throw, typeof (string));
|
||||
// ret = 2
|
||||
il.Emit (OpCodes.Ldc_I4, 2);
|
||||
il.Emit (OpCodes.Stloc, ret_val);
|
||||
// }
|
||||
il.Emit (OpCodes.Leave, leave_label);
|
||||
//catch (string)
|
||||
il.BeginCatchBlock (typeof (string));
|
||||
il.Emit (OpCodes.Pop);
|
||||
// ret = 3
|
||||
il.Emit (OpCodes.Ldc_I4, 3);
|
||||
il.Emit (OpCodes.Stloc, ret_val);
|
||||
//}
|
||||
il.Emit (OpCodes.Leave, leave_label);
|
||||
il.EndExceptionBlock ();
|
||||
|
||||
il.MarkLabel (leave_label);
|
||||
//return ret;
|
||||
il.Emit (OpCodes.Ldloc, ret_val);
|
||||
il.Emit (OpCodes.Ret);
|
||||
|
||||
var dele = (Func<int>)dm.CreateDelegate (typeof (Func<int>));
|
||||
return dele;
|
||||
}
|
||||
|
||||
[Test] //see bxc #59334
|
||||
public void ExceptionWrapping ()
|
||||
{
|
||||
AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (new AssemblyName ("ehatevfheiw"), AssemblyBuilderAccess.Run);
|
||||
AssemblyBuilder ab2 = AppDomain.CurrentDomain.DefineDynamicAssembly (new AssemblyName ("ddf4234"), AssemblyBuilderAccess.Run);
|
||||
CustomAttributeBuilder cab = new CustomAttributeBuilder (
|
||||
typeof (RuntimeCompatibilityAttribute).GetConstructor (new Type [0]),
|
||||
new object [0],
|
||||
new PropertyInfo[] { typeof (RuntimeCompatibilityAttribute).GetProperty ("WrapNonExceptionThrows") },
|
||||
new object[] { true });
|
||||
ab2.SetCustomAttribute (cab);
|
||||
|
||||
AssemblyBuilder ab3 = AppDomain.CurrentDomain.DefineDynamicAssembly (new AssemblyName ("frfhfher"), AssemblyBuilderAccess.Run);
|
||||
//1 NamedArg. Property name: WrapNonExceptionThrows value: true (0x01)
|
||||
byte[] blob = new byte[] { 0x01, 0x00, 0x01, 0x00, 0x54, 0x02, 0x16, 0x57, 0x72, 0x61, 0x70, 0x4E, 0x6F, 0x6E, 0x45, 0x78,
|
||||
0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x54, 0x68, 0x72, 0x6F, 0x77, 0x73, 0x01 };
|
||||
ab3.SetCustomAttribute (typeof (RuntimeCompatibilityAttribute).GetConstructor (new Type [0]), blob);
|
||||
|
||||
DynamicMethod invoke_no_module = new DynamicMethod("throw_1", typeof (int), new Type [0]);
|
||||
DynamicMethod invoke_with_module = new DynamicMethod("throw_2", typeof (int), new Type [0], typeof (DynamicMethodTest).Module);
|
||||
DynamicMethod invoke_with_ab = new DynamicMethod("throw_3", typeof (int), new Type [0], ab.ManifestModule);
|
||||
DynamicMethod invoke_with_ab2 = new DynamicMethod("throw_4", typeof (int), new Type [0], ab2.ManifestModule);
|
||||
DynamicMethod invoke_with_ab3 = new DynamicMethod("throw_5", typeof (int), new Type [0], ab3.ManifestModule);
|
||||
|
||||
int result = 0;
|
||||
try {
|
||||
int res = EmitDelegate (invoke_no_module)();
|
||||
Assert.AreEqual (3, res, "invoke_no_module bad return value");
|
||||
} catch (RuntimeWrappedException e) {
|
||||
Assert.Fail ("invoke_no_module threw RWE");
|
||||
}
|
||||
|
||||
try {
|
||||
int res = EmitDelegate (invoke_with_module)();
|
||||
Assert.Fail ("invoke_with_module did not throw RWE");
|
||||
} catch (RuntimeWrappedException e) {
|
||||
}
|
||||
|
||||
try {
|
||||
int res = EmitDelegate (invoke_with_ab)();
|
||||
Assert.AreEqual (3, res, "invoke_with_ab bad return value");
|
||||
} catch (RuntimeWrappedException e) {
|
||||
Assert.Fail ("invoke_with_ab threw RWE");
|
||||
}
|
||||
|
||||
try {
|
||||
int res = EmitDelegate (invoke_with_ab2)();
|
||||
Assert.Fail ("invoke_with_ab2 did not throw RWE");
|
||||
} catch (RuntimeWrappedException e) {
|
||||
}
|
||||
|
||||
try {
|
||||
int res = EmitDelegate (invoke_with_ab3)();
|
||||
Assert.Fail ("invoke_with_a3 did not throw RWE");
|
||||
} catch (RuntimeWrappedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
#if !MONODROID
|
||||
// RUNTIME: crash
|
||||
[Test]
|
||||
|
@@ -41,16 +41,6 @@ namespace MonoTests.System.Reflection.Emit
|
||||
Assert.IsNull (enumBuilder.DeclaringType, "#3");
|
||||
Assert.IsNull (enumBuilder.ReflectedType, "#4");
|
||||
Assert.AreEqual (_enumType, enumBuilder.UnderlyingSystemType, "#5");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("ValueAdd")]
|
||||
public void TestEnumBuilder_NotInMono ()
|
||||
{
|
||||
// If we decide to fix this (I dont see why we should),
|
||||
// move to the routine above
|
||||
|
||||
EnumBuilder enumBuilder = GenerateEnum ();
|
||||
Assert.IsFalse (enumBuilder.IsSerializable);
|
||||
}
|
||||
|
||||
@@ -187,7 +177,6 @@ namespace MonoTests.System.Reflection.Emit
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
[Category ("ValueAdd")]
|
||||
public void TestFindMembersIncomplete ()
|
||||
{
|
||||
EnumBuilder enumBuilder = GenerateEnum ();
|
||||
@@ -229,7 +218,6 @@ namespace MonoTests.System.Reflection.Emit
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
[Category ("ValueAdd")]
|
||||
public void TestGetConstructorIncomplete ()
|
||||
{
|
||||
EnumBuilder enumBuilder = GenerateEnum ();
|
||||
|
@@ -480,5 +480,136 @@ namespace MonoTests.System.Reflection.Emit
|
||||
Assert.AreEqual (0x02, il [14]); //typedef
|
||||
Assert.AreEqual (0x01, il [19]); //typeref
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MethodRefTokenSame () {
|
||||
// Get the same non-virtual method from a base and a derived type so
|
||||
// that the MemberInfo:DeclaredType differs but the tokens are the same.
|
||||
//
|
||||
// Regression test for bugzilla #59364
|
||||
|
||||
DefineBasicMethod ();
|
||||
|
||||
var m1 = typeof (object).GetMethod ("GetType");
|
||||
var m2 = typeof (string).GetMethod ("GetType");
|
||||
|
||||
var value_getter = typeof (RuntimeMethodHandle).GetProperty ("Value").GetMethod;
|
||||
|
||||
var il = il_gen;
|
||||
|
||||
var loc = il.DeclareLocal (typeof (RuntimeMethodHandle));
|
||||
|
||||
// return ((int)(RuntimeMethodHandle (m1).Value == RuntimeMethodHandle (m2).Value)).ToString ()
|
||||
il.Emit (OpCodes.Ldtoken, m1);
|
||||
il.Emit (OpCodes.Stloc, loc);
|
||||
il.Emit (OpCodes.Ldloca, loc);
|
||||
il.Emit (OpCodes.Call, value_getter);
|
||||
il.Emit (OpCodes.Ldtoken, m2);
|
||||
il.Emit (OpCodes.Stloc, loc);
|
||||
il.Emit (OpCodes.Ldloca, loc);
|
||||
il.Emit (OpCodes.Call, value_getter);
|
||||
il.Emit (OpCodes.Ceq);
|
||||
il.Emit (OpCodes.Box, typeof (Int32));
|
||||
il.Emit (OpCodes.Callvirt, typeof (object).GetMethod ("ToString"));
|
||||
il.Emit (OpCodes.Ret);
|
||||
|
||||
var baked = tb.CreateType ();
|
||||
|
||||
var x = Activator.CreateInstance (baked);
|
||||
var m = baked.GetMethod ("F");
|
||||
|
||||
var s = m.Invoke (x, null);
|
||||
|
||||
Assert.AreEqual ("1", s);
|
||||
|
||||
}
|
||||
|
||||
public class Base<T> {
|
||||
public int x;
|
||||
|
||||
public void M () { }
|
||||
}
|
||||
|
||||
public class Derived : Base<string> {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FieldRefTokenSame () {
|
||||
DefineBasicMethod ();
|
||||
|
||||
// Get the same field from a base and a derived type so hat
|
||||
// the MemberInfo:DeclaredType differs but the tokens are the same.
|
||||
//
|
||||
// Regression test for bugzilla #59364
|
||||
|
||||
var f1 = typeof (Base<string>).GetField ("x");
|
||||
var f2 = typeof (Derived).GetField ("x");
|
||||
|
||||
var value_getter = typeof (RuntimeFieldHandle).GetProperty("Value").GetMethod;
|
||||
|
||||
var il = il_gen;
|
||||
|
||||
var loc = il.DeclareLocal (typeof (RuntimeFieldHandle));
|
||||
|
||||
il.Emit (OpCodes.Ldtoken, f1);
|
||||
il.Emit (OpCodes.Stloc, loc);
|
||||
il.Emit (OpCodes.Ldloca, loc);
|
||||
il.Emit (OpCodes.Call, value_getter);
|
||||
il.Emit (OpCodes.Ldtoken, f2);
|
||||
il.Emit (OpCodes.Stloc, loc);
|
||||
il.Emit (OpCodes.Ldloca, loc);
|
||||
il.Emit (OpCodes.Call, value_getter);
|
||||
il.Emit (OpCodes.Ceq);
|
||||
il.Emit (OpCodes.Box, typeof (Int32));
|
||||
il.Emit (OpCodes.Callvirt, typeof (object).GetMethod ("ToString"));
|
||||
il.Emit (OpCodes.Ret);
|
||||
|
||||
var baked = tb.CreateType ();
|
||||
|
||||
var x = Activator.CreateInstance (baked);
|
||||
var m = baked.GetMethod ("F");
|
||||
|
||||
var s = m.Invoke (x, null);
|
||||
|
||||
Assert.AreEqual ("1", s);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MethodSpecTokenSame () {
|
||||
DefineBasicMethod ();
|
||||
// Get the same method from a base generic instance and
|
||||
// a type derived from it so that the
|
||||
// MemberInfo:DeclaredType differs but the tokens are
|
||||
// the same.
|
||||
//
|
||||
// Regression test for bugzilla #60233
|
||||
|
||||
var m1 = typeof (Base<string>).GetMethod ("M");
|
||||
var m2 = typeof (Derived).GetMethod ("M");
|
||||
|
||||
var il = il_gen;
|
||||
|
||||
var loc = il.DeclareLocal (typeof (Derived));
|
||||
|
||||
il.Emit (OpCodes.Newobj, typeof (Derived).GetConstructor(new Type[]{}));
|
||||
il.Emit (OpCodes.Stloc, loc);
|
||||
il.Emit (OpCodes.Ldloc, loc);
|
||||
il.Emit (OpCodes.Call, m1);
|
||||
il.Emit (OpCodes.Ldloc, loc);
|
||||
il.Emit (OpCodes.Call, m2);
|
||||
il.Emit (OpCodes.Ldstr, "1");
|
||||
il.Emit (OpCodes.Ret);
|
||||
|
||||
var baked = tb.CreateType ();
|
||||
|
||||
var x = Activator.CreateInstance (baked);
|
||||
var m = baked.GetMethod ("F");
|
||||
|
||||
var s = m.Invoke (x, null);
|
||||
|
||||
Assert.AreEqual ("1", s);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
541
mcs/class/corlib/Test/System.Reflection.Emit/SaveTest.cs
Normal file
541
mcs/class/corlib/Test/System.Reflection.Emit/SaveTest.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
cf74124675f61fe27a093af6f9970fd092ba413d
|
||||
e4f73aea23f15dae625b30ee994b5e3d7df58d71
|
@@ -1862,6 +1862,26 @@ public class AssemblyNameTest {
|
||||
|
||||
Assert.AreEqual ("", an.CultureName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDecodingEcmaKey ()
|
||||
{
|
||||
var x = new AssemblyName( "System, PublicKey=00000000000000000400000000000000" );
|
||||
Assert.IsNull (x.GetPublicKey (), "#1");
|
||||
Assert.IsNotNull (x.GetPublicKeyToken (), "#2");
|
||||
|
||||
var t = x.GetPublicKeyToken ();
|
||||
Assert.AreEqual (8, t.Length, "#3");
|
||||
|
||||
Assert.AreEqual (0xB7, t [0], "#4.0");
|
||||
Assert.AreEqual (0x7A, t [1], "#4.1");
|
||||
Assert.AreEqual (0x5C, t [2], "#4.2");
|
||||
Assert.AreEqual (0x56, t [3], "#4.3");
|
||||
Assert.AreEqual (0x19, t [4], "#4.4");
|
||||
Assert.AreEqual (0x34, t [5], "#4.5");
|
||||
Assert.AreEqual (0xE0, t [6], "#4.6");
|
||||
Assert.AreEqual (0x89, t [7], "#4.7");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -502,20 +502,17 @@ namespace MonoTests.System.Reflection
|
||||
public void GetReferencedAssemblies ()
|
||||
{
|
||||
Assembly corlib_test = Assembly.GetExecutingAssembly ();
|
||||
AssemblyName[] names = corlib_test.GetReferencedAssemblies ();
|
||||
foreach (AssemblyName an in names) {
|
||||
Assert.IsNull (an.CodeBase, "CodeBase");
|
||||
Assert.IsNotNull (an.CultureInfo, "CultureInfo");
|
||||
Assert.IsNull (an.EscapedCodeBase, "EscapedCodeBase");
|
||||
Assert.AreEqual (AssemblyNameFlags.None, an.Flags, "Flags");
|
||||
Assert.IsNotNull (an.FullName, "FullName");
|
||||
Assert.AreEqual (AssemblyHashAlgorithm.SHA1, an.HashAlgorithm, "HashAlgorithm");
|
||||
Assert.IsNull (an.KeyPair, "KeyPair");
|
||||
Assert.IsNotNull (an.Name, "Name");
|
||||
Assert.IsNotNull (an.Version, "Version");
|
||||
Assert.AreEqual (AssemblyVersionCompatibility.SameMachine,
|
||||
an.VersionCompatibility, "VersionCompatibility");
|
||||
}
|
||||
AssemblyName an = corlib_test.GetReferencedAssemblies ().First (l => l.Name == "mscorlib");
|
||||
Assert.IsNull (an.CodeBase, "CodeBase");
|
||||
Assert.IsNotNull (an.CultureInfo, "CultureInfo");
|
||||
Assert.IsNull (an.EscapedCodeBase, "EscapedCodeBase");
|
||||
Assert.AreEqual (AssemblyNameFlags.None, an.Flags, "Flags");
|
||||
Assert.IsNotNull (an.FullName, "FullName");
|
||||
Assert.AreEqual (AssemblyHashAlgorithm.SHA1, an.HashAlgorithm, "HashAlgorithm");
|
||||
Assert.IsNull (an.KeyPair, "KeyPair");
|
||||
Assert.IsNotNull (an.Name, "Name");
|
||||
Assert.IsNotNull (an.Version, "Version");
|
||||
Assert.AreEqual (AssemblyVersionCompatibility.SameMachine, an.VersionCompatibility, "VersionCompatibility");
|
||||
}
|
||||
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME // Reflection.Emit is not supported.
|
||||
|
@@ -1046,6 +1046,16 @@ public class DSACryptoServiceProviderTest {
|
||||
dsa = new DSACryptoServiceProvider (minKeySize);
|
||||
dsa.ImportCspBlob (blob);
|
||||
}
|
||||
|
||||
[Test] //bug 38054
|
||||
public void NonExportableKeysAreNonExportable ()
|
||||
{
|
||||
var cspParams = new CspParameters (13, null, "Mono1024");
|
||||
cspParams.KeyContainerName = "TestDSAKey";
|
||||
cspParams.Flags = CspProviderFlags.UseNonExportableKey;
|
||||
var rsa = new DSACryptoServiceProvider(cspParams);
|
||||
Assert.Throws<CryptographicException>(() => rsa.ExportParameters(true));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// HashAlgorithmTest.cs - NUnit Test Cases for HashAlgorithm
|
||||
// HashAlgorithmTestBase.cs - NUnit Test Cases for HashAlgorithm
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot <sebastien@ximian.com>
|
||||
@@ -38,8 +38,9 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
// HashAlgorithm is a abstract class - so most of it's functionality wont
|
||||
// be tested here (but will be in its descendants).
|
||||
|
||||
[TestFixture]
|
||||
public class HashAlgorithmTest {
|
||||
// we can't make this a [TestFixture] since the class is shared with System.Core
|
||||
// and causes issues in XA where these are in the same process.
|
||||
public abstract class HashAlgorithmTestBase {
|
||||
|
||||
protected HashAlgorithm hash;
|
||||
|
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// HashAlgorithmTestImpl.cs
|
||||
//
|
||||
// Author:
|
||||
// Alexander Köplinger <alkpli@microsoft.com>
|
||||
//
|
||||
// Copyright (C) 2017 Microsoft
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace MonoTests.System.Security.Cryptography {
|
||||
|
||||
[TestFixture]
|
||||
public class HashAlgorithmTestImpl : HashAlgorithmTestBase {
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -19,7 +19,7 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
// be tested here (but will be in its descendants).
|
||||
|
||||
[TestFixture]
|
||||
public class KeyedHashAlgorithmTest : HashAlgorithmTest {
|
||||
public class KeyedHashAlgorithmTest : HashAlgorithmTestBase {
|
||||
|
||||
[SetUp]
|
||||
public override void SetUp ()
|
||||
|
@@ -1 +1 @@
|
||||
6e44e3235b24061c7626bc48311a4cacbf686184
|
||||
c9011cb41f6f9a37736eb9d0ba9e89d39e203b67
|
@@ -23,7 +23,7 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
// same results (hence should run a common set of unit tests).
|
||||
|
||||
[TestFixture]
|
||||
public class SHA1CryptoServiceProviderTest : SHA1Test {
|
||||
public class SHA1CryptoServiceProviderTest : SHA1TestBase {
|
||||
|
||||
[SetUp]
|
||||
public override void SetUp ()
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// SHA1Test.cs - NUnit Test Cases for SHA1
|
||||
// SHA1TestBase.cs - NUnit Test Cases for SHA1
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot <sebastien@ximian.com>
|
||||
@@ -24,8 +24,9 @@ namespace MonoTests.System.Security.Cryptography
|
||||
// SHA1 is a abstract class - so most of the test included here wont be tested
|
||||
// on the abstract class but should be tested in ALL its descendants.
|
||||
|
||||
[TestFixture]
|
||||
public class SHA1Test : HashAlgorithmTest {
|
||||
// we can't make this a [TestFixture] since the class is shared with System.Core
|
||||
// and causes issues in XA where these are in the same process.
|
||||
public abstract class SHA1TestBase : HashAlgorithmTestBase {
|
||||
|
||||
[SetUp]
|
||||
public override void SetUp ()
|
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// SHA1TestImpl.cs
|
||||
//
|
||||
// Author:
|
||||
// Alexander Köplinger <alkpli@microsoft.com>
|
||||
//
|
||||
// Copyright (C) 2017 Microsoft
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace MonoTests.System.Security.Cryptography
|
||||
{
|
||||
|
||||
[TestFixture]
|
||||
public class SHA1TestImpl : SHA1TestBase {
|
||||
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user