public void FromXml () { ApplicationMembershipCondition app = new ApplicationMembershipCondition (); SecurityElement se = app.ToXml (); app.FromXml (se); }
public void FromXml_PolicyLevelNull () { ApplicationMembershipCondition app = new ApplicationMembershipCondition (); SecurityElement se = app.ToXml (); app.FromXml (se, null); }
public void ToXml () { ApplicationMembershipCondition app = new ApplicationMembershipCondition (); SecurityElement se = app.ToXml (); Assert.AreEqual ("IMembershipCondition", se.Tag, "Tag"); Assert.IsTrue (se.Attribute ("class").StartsWith ("System.Security.Policy.ApplicationMembershipCondition"), "class"); Assert.AreEqual ("1", se.Attribute ("version"), "version"); Assert.AreEqual ("true", se.Attribute ("LookAtDir"), "LookAtDir"); Assert.AreEqual (se.ToString (), app.ToXml (null).ToString (), "ToXml(null)"); Assert.AreEqual (se.ToString (), app.ToXml (PolicyLevel.CreateAppDomainLevel ()).ToString (), "ToXml(PolicyLevel)"); }
public void FromXml_NoVersion () { ApplicationMembershipCondition app = new ApplicationMembershipCondition (); SecurityElement se = app.ToXml (); SecurityElement w = new SecurityElement (se.Tag); w.AddAttribute ("class", se.Attribute ("class")); app.FromXml (w); }
public void FromXml_NonBooleanLookAtDir () { ApplicationMembershipCondition app = new ApplicationMembershipCondition (); SecurityElement se = app.ToXml (); SecurityElement w = new SecurityElement (se.Tag); w.AddAttribute ("class", se.Attribute ("class")); w.AddAttribute ("version", se.Attribute ("version")); w.AddAttribute ("LookAtDir", "Maybe"); // not (generally) a boolean ;) ApplicationMembershipCondition app2 = new ApplicationMembershipCondition (); app2.FromXml (w); se = app2.ToXml (); Assert.IsNull (se.Attribute ("LookAtDir"), "LookAtDir"); // LookAtDir isn't part of the Equals computation Assert.IsTrue (app2.Equals (app), "Equals-1"); Assert.IsTrue (app.Equals (app2), "Equals-2"); ApplicationMembershipCondition app3 = (ApplicationMembershipCondition)app2.Copy (); se = app3.ToXml (); // LookAtDir isn't copied either Assert.AreEqual ("true", se.Attribute ("LookAtDir"), "Copy-LookAtDir"); }
public void FromXml_InvalidVersion () { ApplicationMembershipCondition app = new ApplicationMembershipCondition (); SecurityElement se = app.ToXml (); SecurityElement w = new SecurityElement (se.Tag); w.AddAttribute ("class", se.Attribute ("class")); w.AddAttribute ("version", "2"); app.FromXml (w); // doesn't seems to care about the version number! }
public void FromXml_NoClass () { ApplicationMembershipCondition app = new ApplicationMembershipCondition (); SecurityElement se = app.ToXml (); SecurityElement w = new SecurityElement (se.Tag); w.AddAttribute ("version", se.Attribute ("version")); app.FromXml (w); // doesn't even care of the class attribute presence }
public void FromXml_InvalidClass () { ApplicationMembershipCondition app = new ApplicationMembershipCondition (); SecurityElement se = app.ToXml (); se.Attributes ["class"] = "Hello world"; app.FromXml (se); }
public void FromXml_WrongTagCase () { ApplicationMembershipCondition app = new ApplicationMembershipCondition (); SecurityElement se = app.ToXml (); se.Tag = "IMEMBERSHIPCONDITION"; // insteapp of IMembershipCondition app.FromXml (se); }
public void FromXml_InvalidTag () { ApplicationMembershipCondition app = new ApplicationMembershipCondition (); SecurityElement se = app.ToXml (); se.Tag = "IMonoship"; app.FromXml (se); }