1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// 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.Runtime.CompilerServices;
using Xunit;
public class TupleElementNamesAttributeTests
{
[Fact]
public static void Constructor()
{
var attribute = new TupleElementNamesAttribute(new string[] { "name1", "name2" });
Assert.NotNull(attribute.TransformNames);
Assert.Equal(new string[] { "name1", "name2" }, attribute.TransformNames);
Assert.Throws<ArgumentNullException>(() => new TupleElementNamesAttribute(null));
}
[TupleElementNames(new string[] { null, "name1", "name2" })]
public object appliedToField = null;
public static void AppliedToParameter([TupleElementNames(new string[] { "name1", null })] object parameter) { }
[TupleElementNames(new string[] { null, "name1", "name2" })]
public static object AppliedToProperty { get; set; }
[event: TupleElementNames(new[] { null, "name1", "name2" })]
public static event Func<int> AppliedToEvent;
[return: TupleElementNames(new[] { null, "name1", "name2" })]
public static void AppliedToReturn()
{
AppliedToEvent();
}
[TupleElementNames(new string[] { null, "name1", "name2" })]
public class AppliedToClass { }
[TupleElementNames(new string[] { null, "name1", "name2" })]
public class AppliedToStruct { }
}
|