本文整理汇总了C#中System.Security.Permissions.EnvironmentPermission.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# EnvironmentPermission.Copy方法的具体用法?C# EnvironmentPermission.Copy怎么用?C# EnvironmentPermission.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Permissions.EnvironmentPermission
的用法示例。
在下文中一共展示了EnvironmentPermission.Copy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PermissionStateUnrestricted
public void PermissionStateUnrestricted ()
{
EnvironmentPermission ep = new EnvironmentPermission (PermissionState.Unrestricted);
AssertNotNull ("EnvironmentPermission(PermissionState.Unrestricted)", ep);
Assert ("IsUnrestricted", ep.IsUnrestricted ());
EnvironmentPermission copy = (EnvironmentPermission) ep.Copy ();
AssertEquals ("Copy.IsUnrestricted", ep.IsUnrestricted (), copy.IsUnrestricted ());
SecurityElement se = ep.ToXml ();
AssertEquals ("ToXml-Unrestricted", "true", (se.Attributes ["Unrestricted"] as string));
}
示例2: PermissionStateUnrestricted
public void PermissionStateUnrestricted ()
{
EnvironmentPermission ep = new EnvironmentPermission (PermissionState.Unrestricted);
Assert.IsNotNull (ep, "EnvironmentPermission(PermissionState.Unrestricted)");
Assert.IsTrue (ep.IsUnrestricted (), "IsUnrestricted");
EnvironmentPermission copy = (EnvironmentPermission) ep.Copy ();
Assert.AreEqual (ep.IsUnrestricted (), copy.IsUnrestricted (), "Copy.IsUnrestricted");
SecurityElement se = ep.ToXml ();
Assert.AreEqual ("true", (se.Attributes ["Unrestricted"] as string), "ToXml-Unrestricted");
}
示例3: PermissionStateNone
public void PermissionStateNone ()
{
EnvironmentPermission ep = new EnvironmentPermission (PermissionState.None);
AssertNotNull ("EnvironmentPermission(PermissionState.None)", ep);
Assert ("IsUnrestricted", !ep.IsUnrestricted ());
EnvironmentPermission copy = (EnvironmentPermission) ep.Copy ();
AssertEquals ("Copy.IsUnrestricted", ep.IsUnrestricted (), copy.IsUnrestricted ());
SecurityElement se = ep.ToXml ();
Assert ("ToXml-class", (se.Attributes ["class"] as string).StartsWith (className));
AssertEquals ("ToXml-version", "1", (se.Attributes ["version"] as string));
}
示例4: PermissionStateNone
public void PermissionStateNone ()
{
EnvironmentPermission ep = new EnvironmentPermission (PermissionState.None);
Assert.IsNotNull (ep, "EnvironmentPermission(PermissionState.None)");
Assert.IsTrue (!ep.IsUnrestricted (), "IsUnrestricted");
EnvironmentPermission copy = (EnvironmentPermission) ep.Copy ();
Assert.AreEqual (ep.IsUnrestricted (), copy.IsUnrestricted (), "Copy.IsUnrestricted");
SecurityElement se = ep.ToXml ();
Assert.IsTrue ((se.Attributes ["class"] as string).StartsWith (className), "ToXml-class");
Assert.AreEqual ("1", (se.Attributes ["version"] as string), "ToXml-version");
}