2 // CommonAceTest.cs - NUnit Test Cases for CommonAce
8 using System.Security.AccessControl;
9 using System.Security.Principal;
10 using NUnit.Framework;
12 namespace MonoTests.System.Security.AccessControl {
14 public class CommonAceTest {
16 public void GetBinaryForm ()
18 SecurityIdentifier builtInAdmins = new SecurityIdentifier (WellKnownSidType.BuiltinAdministratorsSid, null);
19 CommonAce ace = new CommonAce (AceFlags.None, AceQualifier.AccessAllowed, 0x7FFFFFFF, builtInAdmins, false, null);
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);
31 public void MaxOpaqueLength ()
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));