Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElinor Fung <elfung@microsoft.com>2022-03-16 06:05:50 +0300
committerGitHub <noreply@github.com>2022-03-16 06:05:50 +0300
commitd2688883510318aa0114268930fb2022d3dc64cf (patch)
tree187dce6ec6afbcb180cac35f8ece1e1e8e457c37 /src/libraries/System.Runtime.InteropServices/tests
parentc3dbdea91835d67cc461b22125e652ad5063d746 (diff)
Expose `LibraryImportAttribute` (#66434)
Diffstat (limited to 'src/libraries/System.Runtime.InteropServices/tests')
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/Ancillary.Interop.csproj2
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/TestUtils.cs2
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj1
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/LibraryImportAttributeTests.cs19
4 files changed, 21 insertions, 3 deletions
diff --git a/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/Ancillary.Interop.csproj b/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/Ancillary.Interop.csproj
index 60e536023fb..710d935b82f 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/Ancillary.Interop.csproj
+++ b/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/Ancillary.Interop.csproj
@@ -11,9 +11,7 @@
</PropertyGroup>
<ItemGroup>
- <Compile Include="$(LibrariesProjectRoot)Common/src/System/Runtime/InteropServices/LibraryImportAttribute.cs" Link="LibraryImportAttribute.cs" />
<Compile Include="$(LibrariesProjectRoot)Common/src/System/Runtime/InteropServices/GeneratedMarshallingAttribute.cs" Link="GeneratedMarshallingAttribute.cs" />
<Compile Include="$(LibrariesProjectRoot)Common/src/System/Runtime/InteropServices/ArrayMarshaller.cs" Link="ArrayMarshaller.cs" />
- <Compile Include="$(LibrariesProjectRoot)Common/src/System/Runtime/InteropServices/StringMarshalling.cs" Link="StringMarshalling.cs" />
</ItemGroup>
</Project>
diff --git a/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/TestUtils.cs b/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/TestUtils.cs
index cabfb327be4..f1d835ce585 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/TestUtils.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/TestUtils.cs
@@ -183,7 +183,7 @@ namespace LibraryImportGenerator.UnitTests
{
// Include the assembly containing the new attribute and all of its references.
// [TODO] Remove once the attribute has been added to the BCL
- var attrAssem = typeof(LibraryImportAttribute).GetTypeInfo().Assembly;
+ var attrAssem = typeof(MarshalUsingAttribute).GetTypeInfo().Assembly;
return MetadataReference.CreateFromFile(attrAssem.Location);
}
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj
index 072080790a2..46d0d5d3a6e 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj
@@ -48,6 +48,7 @@
<Compile Include="System\Runtime\InteropServices\IDispatchImplAttributeTests.cs" />
<Compile Include="System\Runtime\InteropServices\InterfaceTypeAttributeTests.cs" />
<Compile Include="System\Runtime\InteropServices\LCIDConversionAttributeTests.cs" />
+ <Compile Include="System\Runtime\InteropServices\LibraryImportAttributeTests.cs" />
<Compile Include="System\Runtime\InteropServices\MarshalAsAttributeTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\Copy\ByteArrayTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\Copy\CharArrayTests.cs" />
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/LibraryImportAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/LibraryImportAttributeTests.cs
new file mode 100644
index 00000000000..1ebda2c8883
--- /dev/null
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/LibraryImportAttributeTests.cs
@@ -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.
+
+using Xunit;
+
+namespace System.Runtime.InteropServices.Tests
+{
+ public class LibraryImportAttributeTests
+ {
+ [Theory]
+ [InlineData(null)]
+ [InlineData("LibraryName")]
+ public void Ctor(string libraryName)
+ {
+ var attribute = new LibraryImportAttribute(libraryName);
+ Assert.Equal(libraryName, attribute.LibraryName);
+ }
+ }
+}