public void WriteXmlNoAction () { SamlAuthorizationDecisionStatement a = new SamlAuthorizationDecisionStatement (); a.SamlSubject = new SamlSubject ("myFormat", "myQualifier", "myName"); a.Resource = "resource"; StringWriter sw = new StringWriter (); using (XmlDictionaryWriter dw = CreateWriter (sw)) { a.WriteXml (dw, new SamlSerializer (), null); } }
public void WriteXml1 () { SamlAuthorizationDecisionStatement a = new SamlAuthorizationDecisionStatement (); a.SamlSubject = new SamlSubject ("myFormat", "myQualifier", "myName"); a.Resource = "resource"; a.SamlActions.Add (new SamlAction ("myAction")); a.Evidence = new SamlEvidence (new string [] {"myID"}); StringWriter sw = new StringWriter (); using (XmlDictionaryWriter dw = CreateWriter (sw)) { a.WriteXml (dw, new SamlSerializer (), null); } Assert.AreEqual (String.Format ("<?xml version=\"1.0\" encoding=\"utf-16\"?><saml:AuthorizationDecisionStatement Decision=\"Permit\" Resource=\"resource\" xmlns:saml=\"{0}\"><saml:Subject><saml:NameIdentifier Format=\"myFormat\" NameQualifier=\"myQualifier\">myName</saml:NameIdentifier></saml:Subject><saml:Action>myAction</saml:Action><saml:Evidence><saml:AssertionIDReference>myID</saml:AssertionIDReference></saml:Evidence></saml:AuthorizationDecisionStatement>", SamlConstants.Namespace), sw.ToString ()); }
public void WriteXmlNoSubject () { SamlAuthorizationDecisionStatement a = new SamlAuthorizationDecisionStatement (); StringWriter sw = new StringWriter (); using (XmlDictionaryWriter dw = CreateWriter (sw)) { a.WriteXml (dw, new SamlSerializer (), null); } }