Ejemplo n.º 1
0
        public void AuthzEnumerateSecurityEventSourcesTest()
        {
            var mem = new SafeNativeArray <AUTHZ_SOURCE_SCHEMA_REGISTRATION>(200);
            var sz  = (uint)mem.Size;
            var b   = AuthzEnumerateSecurityEventSources(0, (IntPtr)mem, out var len, ref sz);

            Assert.That(b, Is.True);
            Assert.That(sz, Is.LessThanOrEqualTo(mem.Size));
            Assert.That(len, Is.GreaterThan(0));
            Assert.That(() => TestContext.WriteLine(mem[0].szEventSourceName), Throws.Nothing);
        }
Ejemplo n.º 2
0
 public void AuthzEnumerateSecurityEventSourcesTest()
 {
     using (var mem = new SafeNativeArray <AUTHZ_SOURCE_SCHEMA_REGISTRATION>(200))
     {
         var sz = (uint)mem.Size;
         var b  = AuthzEnumerateSecurityEventSources(0, (IntPtr)mem, out var len, ref sz);
         Assert.That(b, Is.True);
         Assert.That(sz, Is.LessThanOrEqualTo(mem.Size));
         Assert.That(len, Is.GreaterThan(0));
         Assert.That(() => TestContext.WriteLine(string.Join("\n", mem.Take((int)len).Select(r => r.szEventSourceName.ToString()))), Throws.Nothing);
     }
 }
Ejemplo n.º 3
0
        public void Test()
        {
            var a1 = new SafeNativeArray <RECT>(20);

            Assert.That(a1.Count, Is.EqualTo(20));
            Assert.That(a1[5], Is.EqualTo(new RECT()));
            a1.Add(new RECT(1, 1, 1, 1));
            Assert.That(a1.Count, Is.EqualTo(21));
            Assert.That(a1[20], Is.EqualTo(new RECT(1, 1, 1, 1)));
            a1[5] = new RECT(5, 5, 5, 5);
            Assert.That(a1[5], Is.EqualTo(new RECT(5, 5, 5, 5)));
            a1.RemoveAt(5);
            Assert.That(a1.Count, Is.EqualTo(20));
            Assert.That(a1[5], Is.EqualTo(new RECT()));
            Assert.That(a1[19], Is.EqualTo(new RECT(1, 1, 1, 1)));
            a1.Insert(5, new RECT(5, 5, 5, 5));
            Assert.That(a1[5], Is.EqualTo(new RECT(5, 5, 5, 5)));
            Assert.That(a1[20], Is.EqualTo(new RECT(1, 1, 1, 1)));
        }