2 // RawAclTest.cs - NUnit Test Cases for RawAclTest
9 using System.Security.AccessControl;
10 using System.Security.Principal;
11 using NUnit.Framework;
13 namespace MonoTests.System.Security.AccessControl {
16 public class AclTest {
19 public void GetBinaryForm ()
21 RawAcl acl = new RawAcl (1, 0);
23 byte[] buffer = new byte[acl.BinaryLength];
24 acl.GetBinaryForm (buffer, 0);
25 byte[] sdBinary = new byte[] { 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 };
26 Assert.AreEqual (sdBinary, buffer);
29 SecurityIdentifier builtInAdmins = new SecurityIdentifier (WellKnownSidType.BuiltinAdministratorsSid, null);
30 CommonAce ace = new CommonAce (AceFlags.None, AceQualifier.AccessAllowed, 0x7FFFFFFF, builtInAdmins, false, null);
31 acl.InsertAce (0, ace);
32 buffer = new byte[acl.BinaryLength];
33 acl.GetBinaryForm (buffer, 0);
34 sdBinary = new byte[] {
35 0x01, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
36 0x18, 0x00, 0xFF, 0xFF, 0xFF, 0x7F, 0x01, 0x02, 0x00, 0x00,
37 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
39 Assert.AreEqual (sdBinary, buffer);
42 [Test, ExpectedException (typeof (ArgumentOutOfRangeException))]
43 public void NonNegativeCapacity ()
45 new RawAcl (GenericAcl.AclRevision, -1);