Merge pull request #273 from joncham/bug-getpid
[mono.git] / mcs / class / corlib / Test / System.Security.AccessControl / CommonAceTest.cs
1 //
2 // CommonAceTest.cs - NUnit Test Cases for CommonAce
3 //
4 // Author:
5 //      Kenneth Bell
6 //
7
8 using System.Security.AccessControl;
9 using System.Security.Principal;
10 using NUnit.Framework;
11
12 namespace MonoTests.System.Security.AccessControl {
13         [TestFixture]
14         public class CommonAceTest {
15                 [Test]
16                 public void GetBinaryForm ()
17                 {
18                         SecurityIdentifier builtInAdmins = new SecurityIdentifier (WellKnownSidType.BuiltinAdministratorsSid, null);
19                         CommonAce ace = new CommonAce (AceFlags.None, AceQualifier.AccessAllowed, 0x7FFFFFFF, builtInAdmins, false, null);
20                         
21                         byte[] buffer = new byte[ace.BinaryLength];
22                         ace.GetBinaryForm (buffer, 0);
23                         byte[] aceBinary = new byte[] {
24                                 0x00, 0x00, 0x18, 0x00, 0xFF, 0xFF, 0xFF, 0x7F, 0x01, 0x02,
25                                 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00,
26                                 0x20, 0x02, 0x00, 0x00 };
27                         Assert.AreEqual (aceBinary, buffer);
28                 }
29
30                 [Test]
31                 public void MaxOpaqueLength ()
32                 {
33                         Assert.AreEqual (65459, CommonAce.MaxOpaqueLength (true));
34                         Assert.AreEqual (65459, CommonAce.MaxOpaqueLength (false));
35                         Assert.AreEqual (65423, ObjectAce.MaxOpaqueLength (true));
36                         Assert.AreEqual (65423, ObjectAce.MaxOpaqueLength (false));
37                 }
38         }
39 }