示例#1
0
        public void Add_Unrestricted()
        {
            NonAbstractDBDataPermission dbdp = new NonAbstractDBDataPermission(PermissionState.Unrestricted);

            Assert.IsTrue(dbdp.IsUnrestricted(), "IsUnrestricted-1");
            // we lose unrestricted by adding an element
            dbdp.Add(defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
            Assert.IsFalse(dbdp.IsUnrestricted(), "IsUnrestricted-2");
            // removing the element doesn't regain unrestricted status
            dbdp.Clear();
            Assert.IsFalse(dbdp.IsUnrestricted(), "IsUnrestricted-3");
        }
示例#2
0
        public void Add_Duplicates()
        {
            NonAbstractDBDataPermission dbdp = new NonAbstractDBDataPermission(PermissionState.None);

            dbdp.Add(defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
            dbdp.Add(defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
            // no exception but a single element is kept
            Assert.AreEqual(1, dbdp.ToXml().Children.Count, "Count");
            dbdp.Add(defaultConnectString, String.Empty, KeyRestrictionBehavior.PreventUsage);

            dbdp.Clear();
            Assert.IsNull(dbdp.ToXml().Children, "Clear");
        }
示例#3
0
        public void Add_Differents()
        {
            NonAbstractDBDataPermission dbdp = new NonAbstractDBDataPermission(PermissionState.None);

            dbdp.Add(defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
            string connectString = "Data Source=127.0.0.1;Integrated Security=SSPI;Initial Catalog=Northwind;";

            dbdp.Add(connectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
            Assert.AreEqual(2, dbdp.ToXml().Children.Count, "Count");

            dbdp.Clear();
            Assert.IsNull(dbdp.ToXml().Children, "Clear");
        }
示例#4
0
        public void AllowBlankPassword()
        {
            NonAbstractDBDataPermission dbdp = new NonAbstractDBDataPermission(PermissionState.None);

            Assert.IsFalse(dbdp.AllowBlankPassword, "Default");
            dbdp.AllowBlankPassword = true;
            Assert.IsTrue(dbdp.AllowBlankPassword, "True");
            dbdp.Clear();
            // clear the connection list - not the permission itself
            Assert.IsTrue(dbdp.AllowBlankPassword, "Clear");
            dbdp.AllowBlankPassword = false;
            Assert.IsFalse(dbdp.AllowBlankPassword, "False");
        }
示例#5
0
        public void Add()
        {
            NonAbstractDBDataPermission dbdp = new NonAbstractDBDataPermission(PermissionState.None);

            dbdp.Add(defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
            Assert.AreEqual(1, dbdp.ToXml().Children.Count, "Count");

            NonAbstractDBDataPermission copy = (NonAbstractDBDataPermission)dbdp.Copy();

            Assert.AreEqual(1, copy.ToXml().Children.Count, "Copy.Count");

            dbdp.Clear();
            Assert.IsNull(dbdp.ToXml().Children, "Clear");
            Assert.AreEqual(1, copy.ToXml().Children.Count, "Copy.Count-2");
        }
示例#6
0
		public void Add_Unrestricted ()
		{
			NonAbstractDBDataPermission dbdp = new NonAbstractDBDataPermission (PermissionState.Unrestricted);
			Assert.IsTrue (dbdp.IsUnrestricted (), "IsUnrestricted-1");
			// we lose unrestricted by adding an element
			dbdp.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
			Assert.IsFalse (dbdp.IsUnrestricted (), "IsUnrestricted-2");
			// removing the element doesn't regain unrestricted status
			dbdp.Clear ();
			Assert.IsFalse (dbdp.IsUnrestricted (), "IsUnrestricted-3");
		}
示例#7
0
		public void Add_Differents ()
		{
			NonAbstractDBDataPermission dbdp = new NonAbstractDBDataPermission (PermissionState.None);
			dbdp.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
			string connectString = "Data Source=127.0.0.1;Integrated Security=SSPI;Initial Catalog=Northwind;";
			dbdp.Add (connectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
			Assert.AreEqual (2, dbdp.ToXml ().Children.Count, "Count");

			dbdp.Clear ();
			Assert.IsNull (dbdp.ToXml ().Children, "Clear");
		}
示例#8
0
		public void Add_Duplicates ()
		{
			NonAbstractDBDataPermission dbdp = new NonAbstractDBDataPermission (PermissionState.None);
			dbdp.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
			dbdp.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
			// no exception but a single element is kept
			Assert.AreEqual (1, dbdp.ToXml ().Children.Count, "Count");
			dbdp.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.PreventUsage);

			dbdp.Clear ();
			Assert.IsNull (dbdp.ToXml ().Children, "Clear");
		}
示例#9
0
		public void Add ()
		{
			NonAbstractDBDataPermission dbdp = new NonAbstractDBDataPermission (PermissionState.None);
			dbdp.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
			Assert.AreEqual (1, dbdp.ToXml ().Children.Count, "Count");

			NonAbstractDBDataPermission copy = (NonAbstractDBDataPermission)dbdp.Copy ();
			Assert.AreEqual (1, copy.ToXml ().Children.Count, "Copy.Count");

			dbdp.Clear ();
			Assert.IsNull (dbdp.ToXml ().Children, "Clear");
			Assert.AreEqual (1, copy.ToXml ().Children.Count, "Copy.Count-2");
		}
示例#10
0
		public void AllowBlankPassword ()
		{
			NonAbstractDBDataPermission dbdp = new NonAbstractDBDataPermission (PermissionState.None);
			Assert.IsFalse (dbdp.AllowBlankPassword, "Default");
			dbdp.AllowBlankPassword = true;
			Assert.IsTrue (dbdp.AllowBlankPassword, "True");
			dbdp.Clear ();
			// clear the connection list - not the permission itself
			Assert.IsTrue (dbdp.AllowBlankPassword, "Clear");
			dbdp.AllowBlankPassword = false;
			Assert.IsFalse (dbdp.AllowBlankPassword, "False");
		}