|
1 |
| -using ILSourceParser.Common; |
2 |
| -using ILSourceParser.Syntax; |
3 |
| -using ILSourceParser.Utilities; |
4 |
| -using Sprache; |
5 |
| - |
6 |
| -namespace ILSourceParser.Tests; |
7 |
| - |
8 |
| -public class PermissionSetTests |
9 |
| -{ |
10 |
| - private static readonly byte[] s_complexCustomAttributePermissionSetDescendantByteData = |
11 |
| - [ |
12 |
| - 0x2e, 0x01, 0x80, 0x8a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x53, 0x65, 0x63, |
13 |
| - 0x75, 0x72, 0x69, 0x74, 0x79, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, |
14 |
| - 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x50, 0x65, |
15 |
| - 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, |
16 |
| - 0x75, 0x74, 0x65, 0x2c, 0x20, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x52, 0x75, |
17 |
| - 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2c, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, |
18 |
| - 0x3d, 0x38, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74, |
19 |
| - 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c, 0x2c, 0x20, 0x50, |
20 |
| - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, |
21 |
| - 0x62, 0x30, 0x33, 0x66, 0x35, 0x66, 0x37, 0x66, 0x31, 0x31, 0x64, 0x35, 0x30, 0x61, |
22 |
| - 0x33, 0x61, 0x15, 0x01, 0x54, 0x02, 0x10, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, |
23 |
| - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x01 |
24 |
| - ]; |
25 |
| - |
26 |
| - [Fact] |
27 |
| - public void Test() |
28 |
| - { |
29 |
| - var permissionSetParser = new Parser().ParsePermissionSet(); |
30 |
| - const string input = @" |
31 |
| - .permissionset reqmin = ( |
32 |
| - 2e 01 80 8a 53 79 73 74 65 6d 2e 53 65 63 75 72 |
33 |
| - 69 74 79 2e 50 65 72 6d 69 73 73 69 6f 6e 73 2e |
34 |
| - 53 65 63 75 72 69 74 79 50 65 72 6d 69 73 73 69 |
35 |
| - 6f 6e 41 74 74 72 69 62 75 74 65 2c 20 53 79 73 |
36 |
| - 74 65 6d 2e 52 75 6e 74 69 6d 65 2c 20 56 65 72 |
37 |
| - 73 69 6f 6e 3d 38 2e 30 2e 30 2e 30 2c 20 43 75 |
38 |
| - 6c 74 75 72 65 3d 6e 65 75 74 72 61 6c 2c 20 50 |
39 |
| - 75 62 6c 69 63 4b 65 79 54 6f 6b 65 6e 3d 62 30 |
40 |
| - 33 66 35 66 37 66 31 31 64 35 30 61 33 61 15 01 |
41 |
| - 54 02 10 53 6b 69 70 56 65 72 69 66 69 63 61 74 |
42 |
| - 69 6f 6e 01 |
43 |
| - )"; |
44 |
| - var element = permissionSetParser.Parse(input); |
45 |
| - |
46 |
| - Assert.Equal(SecurityAction.ReqMin, element.SecurityAction); |
47 |
| - Assert.True(element.GetRawBytes().SequenceEqual( |
48 |
| - s_complexCustomAttributePermissionSetDescendantByteData)); |
49 |
| - } |
50 |
| -} |
| 1 | +using ILSourceParser.Common; |
| 2 | +using ILSourceParser.Syntax; |
| 3 | +using ILSourceParser.Utilities; |
| 4 | +using Sprache; |
| 5 | + |
| 6 | +namespace ILSourceParser.Tests; |
| 7 | + |
| 8 | +public class PermissionSetTests |
| 9 | +{ |
| 10 | + private static readonly byte[] s_complexCustomAttributePermissionSetDescendantByteData = |
| 11 | + [ |
| 12 | + 0x2e, 0x01, 0x80, 0x8a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x53, 0x65, 0x63, |
| 13 | + 0x75, 0x72, 0x69, 0x74, 0x79, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, |
| 14 | + 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x50, 0x65, |
| 15 | + 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, |
| 16 | + 0x75, 0x74, 0x65, 0x2c, 0x20, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x52, 0x75, |
| 17 | + 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2c, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, |
| 18 | + 0x3d, 0x38, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74, |
| 19 | + 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c, 0x2c, 0x20, 0x50, |
| 20 | + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, |
| 21 | + 0x62, 0x30, 0x33, 0x66, 0x35, 0x66, 0x37, 0x66, 0x31, 0x31, 0x64, 0x35, 0x30, 0x61, |
| 22 | + 0x33, 0x61, 0x15, 0x01, 0x54, 0x02, 0x10, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, |
| 23 | + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x01 |
| 24 | + ]; |
| 25 | + |
| 26 | + [Fact] |
| 27 | + public void Test() |
| 28 | + { |
| 29 | + var permissionSetParser = Parser.ParsePermissionSet(); |
| 30 | + const string input = @" |
| 31 | + .permissionset reqmin = ( |
| 32 | + 2e 01 80 8a 53 79 73 74 65 6d 2e 53 65 63 75 72 |
| 33 | + 69 74 79 2e 50 65 72 6d 69 73 73 69 6f 6e 73 2e |
| 34 | + 53 65 63 75 72 69 74 79 50 65 72 6d 69 73 73 69 |
| 35 | + 6f 6e 41 74 74 72 69 62 75 74 65 2c 20 53 79 73 |
| 36 | + 74 65 6d 2e 52 75 6e 74 69 6d 65 2c 20 56 65 72 |
| 37 | + 73 69 6f 6e 3d 38 2e 30 2e 30 2e 30 2c 20 43 75 |
| 38 | + 6c 74 75 72 65 3d 6e 65 75 74 72 61 6c 2c 20 50 |
| 39 | + 75 62 6c 69 63 4b 65 79 54 6f 6b 65 6e 3d 62 30 |
| 40 | + 33 66 35 66 37 66 31 31 64 35 30 61 33 61 15 01 |
| 41 | + 54 02 10 53 6b 69 70 56 65 72 69 66 69 63 61 74 |
| 42 | + 69 6f 6e 01 |
| 43 | + )"; |
| 44 | + var element = permissionSetParser.Parse(input); |
| 45 | + |
| 46 | + Assert.Equal(SecurityAction.ReqMin, element.SecurityAction); |
| 47 | + Assert.True(element.GetRawBytes().SequenceEqual( |
| 48 | + s_complexCustomAttributePermissionSetDescendantByteData)); |
| 49 | + } |
| 50 | +} |
0 commit comments