public void Default () { OdbcPermissionAttribute a = new OdbcPermissionAttribute (SecurityAction.Assert); Assert.AreEqual (a.ToString (), a.TypeId.ToString (), "TypeId"); Assert.IsFalse (a.Unrestricted, "Unrestricted"); Assert.IsFalse (a.AllowBlankPassword, "AllowBlankPassword"); Assert.AreEqual (String.Empty, a.ConnectionString, "ConnectionString"); Assert.AreEqual (KeyRestrictionBehavior.AllowOnly, a.KeyRestrictionBehavior, "KeyRestrictionBehavior"); Assert.AreEqual (String.Empty, a.KeyRestrictions, "KeyRestrictions"); Assert.IsFalse (a.ShouldSerializeConnectionString (), "ShouldSerializeConnectionString"); Assert.IsFalse (a.ShouldSerializeKeyRestrictions (), "ShouldSerializeConnectionString"); OdbcPermission odbcp = (OdbcPermission)a.CreatePermission (); Assert.IsFalse (odbcp.IsUnrestricted (), "IsUnrestricted"); }
public void Unrestricted () { OdbcPermissionAttribute a = new OdbcPermissionAttribute (SecurityAction.Assert); a.Unrestricted = true; OdbcPermission odbcp = (OdbcPermission)a.CreatePermission (); Assert.IsTrue (odbcp.IsUnrestricted (), "IsUnrestricted"); Assert.IsFalse (a.AllowBlankPassword, "AllowBlankPassword"); Assert.AreEqual (String.Empty, a.ConnectionString, "ConnectionString"); Assert.AreEqual (KeyRestrictionBehavior.AllowOnly, a.KeyRestrictionBehavior, "KeyRestrictionBehavior"); Assert.AreEqual (String.Empty, a.KeyRestrictions, "KeyRestrictions"); a.Unrestricted = false; odbcp = (OdbcPermission)a.CreatePermission (); Assert.IsFalse (odbcp.IsUnrestricted (), "!IsUnrestricted"); }