public void InitTest() { var sid = GetCurrentSid(); var sidStr = sid.ToString(); Assert.That(sidStr, Does.StartWith("S-1-5-")); var ssid = sid.ToString().Substring(6).Split('-').Select(int.Parse).ToArray(); var i = ssid[0]; var dest = new int[ssid.Length - 1]; Array.Copy(ssid, 1, dest, 0, ssid.Length - 1); var sid2 = PSID.Init(KnownSIDAuthority.SECURITY_NT_AUTHORITY, i, dest); Assert.That(sid2.IsValidSid); Assert.That(sid, Is.EqualTo(sid2)); }
public void ToStringTest() { var sid = PSID.Init(KnownSIDAuthority.SECURITY_WORLD_SID_AUTHORITY, KnownSIDRelativeID.SECURITY_WORLD_RID); Assert.That(sid.ToString(), Is.EqualTo("S-1-1-0")); }