public void WriteXmlNullSubject() { SamlAuthenticationStatement c = new SamlAuthenticationStatement(); StringWriter sw = new StringWriter(); using (XmlDictionaryWriter dw = CreateWriter(sw)) { c.WriteXml(dw, new SamlSerializer(), null); } }
public void WriteXml1() { SamlAuthenticationStatement c = new SamlAuthenticationStatement(); c.SamlSubject = new SamlSubject("myFormat", "myQualifier", "myName"); DateTime instant = DateTime.SpecifyKind(new DateTime(2000, 1, 1), DateTimeKind.Utc); c.AuthenticationInstant = instant; c.DnsAddress = "123.45.67.89"; c.IPAddress = "98.76.54.32"; StringWriter sw = new StringWriter(); using (XmlDictionaryWriter dw = CreateWriter(sw)) { c.WriteXml(dw, new SamlSerializer(), null); } Assert.AreEqual(String.Format("<?xml version=\"1.0\" encoding=\"utf-16\"?><saml:AuthenticationStatement AuthenticationMethod=\"urn:oasis:names:tc:SAML:1.0:am:unspecified\" AuthenticationInstant=\"2000-01-01T00:00:00.000Z\" xmlns:saml=\"{0}\"><saml:Subject><saml:NameIdentifier Format=\"myFormat\" NameQualifier=\"myQualifier\">myName</saml:NameIdentifier></saml:Subject><saml:SubjectLocality IPAddress=\"98.76.54.32\" DNSAddress=\"123.45.67.89\" /></saml:AuthenticationStatement>", SamlConstants.Namespace), sw.ToString()); }