2 // RawAclTest.cs - NUnit Test Cases for RawAclTest
8 using System.Security.AccessControl;
9 using System.Security.Principal;
10 using NUnit.Framework;
12 namespace MonoTests.System.Security.AccessControl {
15 public class AclTest {
18 public void GetBinaryForm ()
20 RawAcl acl = new RawAcl (1, 0);
22 byte[] buffer = new byte[acl.BinaryLength];
23 acl.GetBinaryForm (buffer, 0);
24 byte[] sdBinary = new byte[] { 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 };
25 Assert.AreEqual (sdBinary, buffer);
28 SecurityIdentifier builtInAdmins = new SecurityIdentifier (WellKnownSidType.BuiltinAdministratorsSid, null);
29 CommonAce ace = new CommonAce (AceFlags.None, AceQualifier.AccessAllowed, 0x7FFFFFFF, builtInAdmins, false, null);
30 acl.InsertAce (0, ace);
31 buffer = new byte[acl.BinaryLength];
32 acl.GetBinaryForm (buffer, 0);
33 sdBinary = new byte[] {
34 0x01, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
35 0x18, 0x00, 0xFF, 0xFF, 0xFF, 0x7F, 0x01, 0x02, 0x00, 0x00,
36 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
38 Assert.AreEqual (sdBinary, buffer);