Esempio n. 1
0
        public void MissingPasswordWhenUserSigninRequestThrows()
        {
            ServiceLocator.Instance.RegisterPayloadClaimsManager(InvalidPasswordPayloadClaim.AvoidingClaim());
            AspenException exception = Assert.Throws <AspenException>(() => GetDelegatedClient());

            Assert.That(exception.EventId, Is.EqualTo("15852"));
            Assert.That(exception.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
            StringAssert.IsMatch("'Password' no puede ser nulo ni vacío", exception.Message);
        }
Esempio n. 2
0
        public void NullOrEmptyPasswordWhenUserSigninRequestThrows()
        {
            IList <IPayloadClaimsManager> passwordClaimBehaviors = new List <IPayloadClaimsManager>()
            {
                InvalidPasswordPayloadClaim.WithClaimBehavior(() => null),
                InvalidPasswordPayloadClaim.WithClaimBehavior(() => string.Empty),
                InvalidPasswordPayloadClaim.WithClaimBehavior(() => "     ")
            };

            foreach (IPayloadClaimsManager behavior in passwordClaimBehaviors)
            {
                ServiceLocator.Instance.RegisterPayloadClaimsManager(behavior);
                AspenException exception = Assert.Throws <AspenException>(() => GetDelegatedClient());
                Assert.That(exception.EventId, Is.EqualTo("15852"));
                Assert.That(exception.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
                StringAssert.IsMatch("'Password' no puede ser nulo ni vacío", exception.Message);
            }
        }