示例#1
0
        public void NullOrEmptyDocTypeWhenUserSigninRequestThrows()
        {
            IList <IPayloadClaimsManager> docTypeClaimBehaviors = new List <IPayloadClaimsManager>()
            {
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => null),
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => string.Empty),
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => "     ")
            };

            foreach (IPayloadClaimsManager behavior in docTypeClaimBehaviors)
            {
                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("'DocType' no puede ser nulo ni vacío", exception.Message);
            }
        }
示例#2
0
        public void UnsupportedDocTypeWhenUserSigninRequestThrows()
        {
            IList <IPayloadClaimsManager> docTypeClaimBehaviors = new List <IPayloadClaimsManager>()
            {
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => "01"),
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => "10"),
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => "xx"),
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => "XX"),
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => "Xx"),
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => "xX"),
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => "cc"),
                InvalidDocTypePayloadClaim.WithClaimBehavior(() => "Cc")
            };

            foreach (IPayloadClaimsManager behavior in docTypeClaimBehaviors)
            {
                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("no se reconoce como un tipo de identificación", exception.Message);
            }
        }