public void ThrowsExceptionWhenAuthnStatementSessionNotOnOrAfterInPast()
            {
                // Arrange
                var assertion = AssertionUtil.GetBasicAssertion();
                var statements = new List<StatementAbstract>(assertion.Items);
                var authnStatement = new AuthnStatement
                                         {
                                             AuthnInstant = DateTime.UtcNow,
                                             SessionNotOnOrAfter = DateTime.UtcNow.AddHours(-1)
                                         };
                statements.Add(authnStatement);
                assertion.Items = statements.ToArray();

                var validator = new Saml20AssertionValidator(AssertionUtil.GetAudiences(), false);

                // Act
                validator.ValidateTimeRestrictions(assertion, new TimeSpan());
            }
            public void ThrowsExceptionWhenTimeRestrictionNotOnOrAfterNow()
            {
                // Arrange
                var assertion = AssertionUtil.GetBasicAssertion();
                var validator = new Saml20AssertionValidator(AssertionUtil.GetAudiences(), false);

                // Test with NotOnOrAfter that pre-dates now
                assertion.Conditions.NotBefore = null;
                assertion.Conditions.NotOnOrAfter = DateTime.UtcNow;

                // Act
                validator.ValidateTimeRestrictions(assertion, new TimeSpan());
            }
            public void ThrowsExceptionWhenTimeRestrictionNotBeforeIsInvalid()
            {
                // Arrange
                // Test with NotBefore that post-dates now
                var assertion = AssertionUtil.GetBasicAssertion();
                var validator = new Saml20AssertionValidator(AssertionUtil.GetAudiences(), false);

                assertion.Conditions.NotBefore = DateTime.Now.AddDays(1);
                assertion.Conditions.NotOnOrAfter = null;

                // Act
                validator.ValidateTimeRestrictions(assertion, new TimeSpan());
            }