本文整理汇总了C#中MonoTests.System.Data.Common.NonAbstractDBDataPermission.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# NonAbstractDBDataPermission.Copy方法的具体用法?C# NonAbstractDBDataPermission.Copy怎么用?C# NonAbstractDBDataPermission.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoTests.System.Data.Common.NonAbstractDBDataPermission
的用法示例。
在下文中一共展示了NonAbstractDBDataPermission.Copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsSubset
public void IsSubset ()
{
NonAbstractDBDataPermission empty = new NonAbstractDBDataPermission (PermissionState.None);
Assert.IsTrue (empty.IsSubsetOf (empty), "Empty-Empty");
NonAbstractDBDataPermission dbdp1 = new NonAbstractDBDataPermission (PermissionState.None);
dbdp1.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
Assert.IsTrue (empty.IsSubsetOf (dbdp1), "Empty-1");
Assert.IsFalse (dbdp1.IsSubsetOf (empty), "1-Empty");
Assert.IsTrue (dbdp1.IsSubsetOf (dbdp1), "1-1");
NonAbstractDBDataPermission dbdp2 = (NonAbstractDBDataPermission)dbdp1.Copy ();
dbdp2.Add (defaultConnectString2, String.Empty, KeyRestrictionBehavior.AllowOnly);
Assert.IsTrue (dbdp1.IsSubsetOf (dbdp2), "1-2");
Assert.IsFalse (dbdp2.IsSubsetOf (dbdp1), "2-1");
Assert.IsTrue (dbdp2.IsSubsetOf (dbdp2), "2-2");
NonAbstractDBDataPermission dbdp3 = new NonAbstractDBDataPermission (PermissionState.None);
dbdp3.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.PreventUsage);
Assert.IsTrue (dbdp3.IsSubsetOf (dbdp1), "3-1");
Assert.IsTrue (dbdp1.IsSubsetOf (dbdp3), "1-3");
Assert.IsTrue (dbdp3.IsSubsetOf (dbdp3), "3-3");
NonAbstractDBDataPermission unr = new NonAbstractDBDataPermission (PermissionState.Unrestricted);
Assert.IsTrue (dbdp1.IsSubsetOf (unr), "1-unrestricted");
Assert.IsFalse (unr.IsSubsetOf (dbdp1), "unrestricted-1");
Assert.IsTrue (dbdp2.IsSubsetOf (unr), "2-unrestricted");
Assert.IsFalse (unr.IsSubsetOf (dbdp2), "unrestricted-2");
Assert.IsTrue (dbdp3.IsSubsetOf (unr), "3-unrestricted");
Assert.IsFalse (unr.IsSubsetOf (dbdp3), "unrestricted-3");
Assert.IsTrue (unr.IsSubsetOf (unr), "unrestricted-unrestricted");
}
示例2: Union
public void Union ()
{
NonAbstractDBDataPermission empty = new NonAbstractDBDataPermission (PermissionState.None);
NonAbstractDBDataPermission union = (NonAbstractDBDataPermission) empty.Union (empty);
Assert.IsNull (union, "Empty U Empty");
NonAbstractDBDataPermission dbdp1 = new NonAbstractDBDataPermission (PermissionState.None);
dbdp1.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly);
union = (NonAbstractDBDataPermission) empty.Union (dbdp1);
Check ("Empty U 1", union, false, false, 1);
NonAbstractDBDataPermission dbdp2 = (NonAbstractDBDataPermission)dbdp1.Copy ();
dbdp2.Add (defaultConnectString2, String.Empty, KeyRestrictionBehavior.AllowOnly);
union = (NonAbstractDBDataPermission) dbdp1.Union (dbdp2);
Check ("1 U 2", union, false, false, 2);
NonAbstractDBDataPermission dbdp3 = new NonAbstractDBDataPermission (PermissionState.None);
dbdp3.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.PreventUsage);
union = (NonAbstractDBDataPermission) dbdp2.Union (dbdp3);
Check ("2 U 3", union, false, false, 2);
NonAbstractDBDataPermission dbdp4 = new NonAbstractDBDataPermission (PermissionState.None);
dbdp4.Add (defaultConnectString, "Data Source=;", KeyRestrictionBehavior.PreventUsage);
union = (NonAbstractDBDataPermission) dbdp3.Union (dbdp4);
Check ("3 U 4", union, false, false, 1);
NonAbstractDBDataPermission unr = new NonAbstractDBDataPermission (PermissionState.Unrestricted);
union = (NonAbstractDBDataPermission) unr.Union (empty);
Check ("unrestricted U empty", union, false, true, 0);
union = (NonAbstractDBDataPermission)unr.Union (dbdp4);
Check ("unrestricted U 4", union, false, true, 0);
}
示例3: Add
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");
}