Esempio n. 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");
        }
Esempio n. 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");
        }
Esempio n. 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");
        }
Esempio n. 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");
        }
Esempio n. 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");
        }
Esempio n. 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");
		}
Esempio n. 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");
		}
Esempio n. 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");
		}
Esempio n. 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");
		}
Esempio n. 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");
		}