public void Saml2ArtifactResolve_ToXml()
        {
            var artifact = "MyArtifact";
            var subject  = new Saml2ArtifactResolve()
            {
                Issuer   = new EntityId("http://sp.example.com"),
                Artifact = artifact
            };

            var actual = XElement.Parse(subject.ToXml());

            var expected = XElement.Parse(
                @"<saml2p:ArtifactResolve
    xmlns:saml2p=""urn:oasis:names:tc:SAML:2.0:protocol""
    xmlns:saml2 = ""urn:oasis:names:tc:SAML:2.0:assertion""
    ID = ""_6c3a4f8b9c2d"" Version = ""2.0""
    IssueInstant = ""2004-01-21T19:00:49Z"" >
    <saml2:Issuer>http://sp.example.com</saml2:Issuer>
    <saml2:Artifact>MyArtifact</saml2:Artifact>
 </saml2p:ArtifactResolve>");

            // Set generated expected values to the actual.
            expected.Attribute("ID").Value           = actual.Attribute("ID").Value;
            expected.Attribute("IssueInstant").Value = actual.Attribute("IssueInstant").Value;

            actual.ShouldBeEquivalentTo(expected, opt => opt.IgnoringCyclicReferences());
        }
Пример #2
0
        public void Saml2ArtifactResolve_ToXml_ToXml_PreservesCustomChanges()
        {
            var subject = new Saml2ArtifactResolve();

            subject.XmlCreated += (s, e) =>
            {
                e.Add(new XAttribute("CustomAttribute", "CustomValue"));
            };

            var xml = subject.ToXml();

            xml.Should().Contain("CustomAttribute=\"CustomValue\"");
        }