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

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs')
-rw-r--r--src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs b/src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs
index b6651222ff..d4fac8e029 100644
--- a/src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs
+++ b/src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs
@@ -2,6 +2,9 @@
// 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.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
using Xunit;
namespace System.Threading.Tasks.Tests
@@ -311,6 +314,18 @@ namespace System.Threading.Tasks.Tests
Assert.Same(string.Empty, new ValueTask<DateTime>(new TaskCompletionSource<DateTime>().Task).ToString());
}
+ [Theory]
+ [InlineData(typeof(ValueTask<>))]
+ [InlineData(typeof(ValueTask<int>))]
+ [InlineData(typeof(ValueTask<string>))]
+ public void AsyncBuilderAttribute_ValueTaskAttributed(Type valueTaskType)
+ {
+ CustomAttributeData aba = valueTaskType.GetTypeInfo().CustomAttributes.Single(
+ attr => attr.AttributeType.FullName == "System.Runtime.CompilerServices.AsyncBuilderAttribute");
+ Assert.True(aba.AttributeType.GetTypeInfo().IsNotPublic);
+ Assert.Equal(typeof(AsyncValueTaskMethodBuilder<>), aba.ConstructorArguments[0].Value);
+ }
+
private sealed class TrackingSynchronizationContext : SynchronizationContext
{
internal int Posts { get; set; }