Inheritance: ISaml20SubjectConfirmationDataValidator
        public void SubjectConfirmationData_Invalid_KeyInfoConfirmationData_IncompleteAnyElement_NoChildren()
        {
            KeyInfoConfirmationData subjectConfirmationData = new KeyInfoConfirmationData();
            subjectConfirmationData.Recipient = "urn:wellformed.uri:ok";
            XmlDocument doc = new XmlDocument();
            subjectConfirmationData.AnyElements = new XmlElement[] { doc.CreateElement("ds", "KeyInfo", Saml20Constants.XMLDSIG) };

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
        public void SubjectConfirmationData_Invalid_KeyInfoConfirmationData_WrongAnyElement()
        {
            KeyInfoConfirmationData subjectConfirmationData = new KeyInfoConfirmationData();
            subjectConfirmationData.Recipient = "urn:wellformed.uri:ok";
            XmlDocument doc = new XmlDocument();
            XmlElement elem = doc.CreateElement("ds", "KeyInfo", "http://wrongNameSpace.uri");
            elem.AppendChild((doc.CreateElement("ds", "KeyName", Saml20Constants.XMLDSIG)));

            subjectConfirmationData.AnyElements = new XmlElement[] { elem };

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
        public void SubjectConfirmationData_Invalid_KeyInfoConfirmationData_NoAnyElement()
        {
            KeyInfoConfirmationData subjectConfirmationData = new KeyInfoConfirmationData();
            subjectConfirmationData.Recipient = "urn:wellformed.uri:ok";

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
        public void SubjectConfirmationData_Invalid_KeyInfoConfirmationData_IncompleteAnyElement()
        {
            KeyInfoConfirmationData subjectConfirmationData = new KeyInfoConfirmationData();
            subjectConfirmationData.Recipient = "urn:wellformed.uri:ok";
            XmlDocument doc = new XmlDocument();
            subjectConfirmationData.AnyElements = new XmlElement[] { doc.CreateElement("ds", "KeyInfo", "http://wrongNameSpace.uri") };

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
        public void SubjectConfirmationDataValidTimeIntervalSettings()
        {
            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();

            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.NotBefore = new DateTime(2008, 01, 30, 17, 13, 0, 500, DateTimeKind.Utc);
            subjectConfirmationData.NotOnOrAfter = subjectConfirmationData.NotBefore.Value.AddHours(1);

            validator.ValidateSubjectConfirmationData(subjectConfirmationData);

            subjectConfirmationData.NotBefore = null;
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);

            // DateTime validation wrt DateTime.UtcNow is NOT done by the validators
            // so a future-NotBefore must be valid
            subjectConfirmationData.NotBefore = subjectConfirmationData.NotOnOrAfter;
            subjectConfirmationData.NotOnOrAfter = null;
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);

            subjectConfirmationData.NotBefore = null;
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
        public void SubjectConfirmationDataInvalidTimeInterval()
        {
            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.NotBefore = new DateTime(2008, 01, 30, 17, 13, 0, 500, DateTimeKind.Utc);
            subjectConfirmationData.NotOnOrAfter = subjectConfirmationData.NotBefore.Value.AddHours(-1);

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
        public void SubjectConfirmationDataValidRecipient()
        {
            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.Recipient = "urn:wellformed.uri:ok";

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);


        }
        public void SubjectConfirmationDataInvalidRecipient()
        {
            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.Recipient = "malformed uri";

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
        public void SubjectConfirmationDataEmptyRecipient()
        {
            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.Recipient = " ";

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }