Mutexes and event wait handles now work, with tests included. Fixed the exception...
[mono.git] / mcs / class / corlib / Test / System.Security.AccessControl / RawAclTest.cs
1 //
2 // RawAclTest.cs - NUnit Test Cases for RawAclTest
3 //
4 // Author:
5 //      Kenneth Bell
6 //
7
8 using System;
9 using System.Security.AccessControl;
10 using System.Security.Principal;
11 using NUnit.Framework;
12
13 namespace MonoTests.System.Security.AccessControl {
14
15         [TestFixture]
16         public class AclTest {
17
18                 [Test]
19                 public void GetBinaryForm ()
20                 {
21                         RawAcl acl = new RawAcl (1, 0);
22                         
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);
27                         
28                         
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,
38                                 0x00, 0x00 };
39                         Assert.AreEqual (sdBinary, buffer);
40                 }
41                 
42                 [Test, ExpectedException (typeof (ArgumentOutOfRangeException))]
43                 public void NonNegativeCapacity ()
44                 {
45                         new RawAcl (GenericAcl.AclRevision, -1);
46                 }
47         }
48 }