public void ThrowsExceptionWhenSubjectConfirmationContainsElementsOfWrongIdentifier() { // Arrange var saml20Assertion = AssertionUtil.GetBasicAssertion(); saml20Assertion.Subject.Items = new object[] { string.Empty, 24, new List <object>(1), new Advice() }; var validator = new Saml20SubjectValidator(); // Act validator.ValidateSubject(saml20Assertion.Subject); }
public void ThrowsExceptionWhenSubjectConfirmationDoesNotContainSubject() { // Arrange var saml20Assertion = AssertionUtil.GetBasicAssertion(); saml20Assertion.Subject.Items = new object[] { }; var validator = new Saml20SubjectValidator(); // Act validator.ValidateSubject(saml20Assertion.Subject); }
public void ThrowsExceptionWhenSubjectConfirmationContainsElementsOfWrongIdentifier() { // Arrange var saml20Assertion = AssertionUtil.GetBasicAssertion(); saml20Assertion.Subject.Items = new object[] { string.Empty, 24, new List <object>(1), new Advice() }; var validator = new Saml20SubjectValidator(); // Act Assert.Throws <Saml20FormatException>(() => validator.ValidateSubject(saml20Assertion.Subject), "Subject must have either NameID, EncryptedID or SubjectConfirmation subelement."); }
public void ThrowsExceptionWhenSubjectConfirmationDoesNotContainSubject() { // Arrange var saml20Assertion = AssertionUtil.GetBasicAssertion(); saml20Assertion.Subject.Items = new object[] { }; var validator = new Saml20SubjectValidator(); // Act Assert.Throws <Saml20FormatException>(() => validator.ValidateSubject(saml20Assertion.Subject), "Subject MUST contain either an identifier or a subject confirmation"); }