diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-09-27 22:36:23 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-09-27 23:47:05 +0300 |
commit | 01f56e7d4e569c96f2d4237d6d2ecfa341a3bc78 (patch) | |
tree | 11acc921a4011f0f5d05231212a23f055584a282 /mcs/class/System.Security | |
parent | 8ce85205d90c76a235c8b87d43dc9072848a3af7 (diff) |
[System.Security] Switch tests to use embedded test resources
Diffstat (limited to 'mcs/class/System.Security')
4 files changed, 18 insertions, 12 deletions
diff --git a/mcs/class/System.Security/Makefile b/mcs/class/System.Security/Makefile index e349d9ae948..3b776595772 100644 --- a/mcs/class/System.Security/Makefile +++ b/mcs/class/System.Security/Makefile @@ -14,11 +14,7 @@ LIB_MCS_FLAGS = -unsafe -nowarn:414,618 -d:SECURITY_DEP LOCAL_MCS_FLAGS = -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:168,169,183,219,414 - -XTEST_LIB_REFS = System.Core System Facades/System.Linq Facades/System.Threading.Tasks - -EXTRA_DISTFILES = \ +TEST_RESOURCE_FILES = \ Test/System.Security.Cryptography.Xml/sample.pfx \ Test/System.Security.Cryptography.Xml/EncryptedXmlSample1.xml \ Test/System.Security.Cryptography.Xml/EncryptedXmlSample2.xml \ @@ -26,4 +22,10 @@ EXTRA_DISTFILES = \ Test/System.Security.Cryptography.Pkcs/detached.data \ Test/System.Security.Cryptography.Pkcs/detached.p7 +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:168,169,183,219,414 $(foreach r, $(TEST_RESOURCE_FILES), -resource:$(r),$(r)) + +XTEST_LIB_REFS = System.Core System Facades/System.Linq Facades/System.Threading.Tasks + +EXTRA_DISTFILES = $(TEST_RESOURCE_FILES) + include ../../build/library.make diff --git a/mcs/class/System.Security/System.Security_test.dll.sources b/mcs/class/System.Security/System.Security_test.dll.sources index 31b9d8a3db7..158777d5086 100644 --- a/mcs/class/System.Security/System.Security_test.dll.sources +++ b/mcs/class/System.Security/System.Security_test.dll.sources @@ -1,4 +1,5 @@ ../../corlib/corefx/SR.cs +../../test-helpers/TestResourceHelper.cs System.Security.Cryptography/CryptographicAttributeObjectCollectionTest.cs System.Security.Cryptography/CryptographicAttributeObjectEnumeratorTest.cs System.Security.Cryptography/CryptographicAttributeTest.cs diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignedCmsTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignedCmsTest.cs index 0a8c85e6853..cd1979fd0de 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignedCmsTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignedCmsTest.cs @@ -38,6 +38,8 @@ using System.Security.Cryptography; using System.Security.Cryptography.Pkcs; using System.Security.Cryptography.X509Certificates; +using MonoTests.Helpers; + namespace MonoTests.System.Security.Cryptography.Pkcs { [TestFixture] @@ -441,9 +443,8 @@ namespace MonoTests.System.Security.Cryptography.Pkcs { [Test] public void CheckSignatureDetachedSignedCms () { - string path = Path.Combine ("Test", "System.Security.Cryptography.Pkcs"); - var signedBytes = File.ReadAllBytes (Path.Combine (path, "detached.data")); - var bytes = File.ReadAllBytes (Path.Combine (path, "detached.p7")); + var signedBytes = File.ReadAllBytes (TestResourceHelper.GetFullPathOfResource ("Test/System.Security.Cryptography.Pkcs/detached.data")); + var bytes = File.ReadAllBytes (TestResourceHelper.GetFullPathOfResource ("Test/System.Security.Cryptography.Pkcs/detached.p7")); var oid = new Oid ("1.2.840.113549.1.7.2"); var contentInfo = new ContentInfo (oid, signedBytes); diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/EncryptedXmlTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/EncryptedXmlTest.cs index 82fc0fb433a..021d29336fb 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/EncryptedXmlTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/EncryptedXmlTest.cs @@ -18,6 +18,8 @@ using System.Xml; using NUnit.Framework; +using MonoTests.Helpers; + namespace MonoTests.System.Security.Cryptography.Xml { [TestFixture] @@ -26,7 +28,7 @@ namespace MonoTests.System.Security.Cryptography.Xml [Test] public void Sample1 () { - AssertDecryption1 ("Test/System.Security.Cryptography.Xml/EncryptedXmlSample1.xml"); + AssertDecryption1 (TestResourceHelper.GetFullPathOfResource ("Test/System.Security.Cryptography.Xml/EncryptedXmlSample1.xml")); } void AssertDecryption1 (string filename) @@ -35,7 +37,7 @@ namespace MonoTests.System.Security.Cryptography.Xml doc.PreserveWhitespace = true; doc.Load (filename); EncryptedXml encxml = new EncryptedXml (doc); - RSACryptoServiceProvider rsa = new X509Certificate2 ("Test/System.Security.Cryptography.Xml/sample.pfx", "mono").PrivateKey as RSACryptoServiceProvider; + RSACryptoServiceProvider rsa = new X509Certificate2 (TestResourceHelper.GetFullPathOfResource ("Test/System.Security.Cryptography.Xml/sample.pfx"), "mono").PrivateKey as RSACryptoServiceProvider; XmlNamespaceManager nm = new XmlNamespaceManager (doc.NameTable); nm.AddNamespace ("s", "http://www.w3.org/2003/05/soap-envelope"); nm.AddNamespace ("o", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); @@ -68,7 +70,7 @@ namespace MonoTests.System.Security.Cryptography.Xml XmlDocument doc = new XmlDocument (); doc.PreserveWhitespace = true; - doc.Load ("Test/System.Security.Cryptography.Xml/EncryptedXmlSample2.xml"); + doc.Load (TestResourceHelper.GetFullPathOfResource ("Test/System.Security.Cryptography.Xml/EncryptedXmlSample2.xml")); EncryptedXml encxml = new EncryptedXml (doc); EncryptedData edata = new EncryptedData (); edata.LoadXml (doc.DocumentElement); @@ -78,7 +80,7 @@ namespace MonoTests.System.Security.Cryptography.Xml [Test] public void Sample3 () { - AssertDecryption1 ("Test/System.Security.Cryptography.Xml/EncryptedXmlSample3.xml"); + AssertDecryption1 (TestResourceHelper.GetFullPathOfResource ("Test/System.Security.Cryptography.Xml/EncryptedXmlSample3.xml")); } [Test] |