public void TestArgumentExceptions() { var enumeratedRights = new [] { AccessRight.OpenFolder, AccessRight.CreateFolder }; var array = new AccessRight[10]; var rights = new AccessRights(enumeratedRights); Assert.Throws <ArgumentNullException> (() => rights.AddRange((string)null)); Assert.Throws <ArgumentNullException> (() => rights.AddRange((IEnumerable <AccessRight>)null)); Assert.Throws <ArgumentNullException> (() => new AccessRights((string)null)); Assert.Throws <ArgumentNullException> (() => new AccessRights((IEnumerable <AccessRight>)null)); Assert.Throws <ArgumentOutOfRangeException> (() => { var x = rights [-1]; }); Assert.Throws <ArgumentNullException> (() => rights.CopyTo(null, 0)); Assert.Throws <ArgumentOutOfRangeException> (() => rights.CopyTo(array, -1)); var control = new AccessControl("control"); Assert.Throws <ArgumentNullException> (() => new AccessControl(null)); Assert.Throws <ArgumentNullException> (() => new AccessControl(null, "rk")); Assert.Throws <ArgumentNullException> (() => new AccessControl(null, enumeratedRights)); Assert.Throws <ArgumentNullException> (() => new AccessControl("name", (string)null)); Assert.Throws <ArgumentNullException> (() => new AccessControl("name", (IEnumerable <AccessRight>)null)); var list = new AccessControlList(); Assert.Throws <ArgumentNullException> (() => new AccessControlList(null)); //Assert.Throws<ArgumentNullException> (() => list.Add (null)); Assert.Throws <ArgumentNullException> (() => list.AddRange(null)); }