예제 #1
0
        public void MissingDocNumberWhenUserSigninRequestThrows()
        {
            ServiceLocator.Instance.RegisterPayloadClaimsManager(InvalidDocNumberPayloadClaim.AvoidingClaim());
            AspenException exception = Assert.Throws <AspenException>(() => GetDelegatedClient());

            Assert.That(exception.EventId, Is.EqualTo("15852"));
            Assert.That(exception.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
            StringAssert.IsMatch("'DocNumber' no puede ser nulo ni vacío", exception.Message);
        }
예제 #2
0
        public void NullOrEmptyDocNumberWhenUserSigninRequestThrows()
        {
            IList <IPayloadClaimsManager> docNumberClaimBehaviors = new List <IPayloadClaimsManager>()
            {
                InvalidDocNumberPayloadClaim.WithClaimBehavior(() => null),
                InvalidDocNumberPayloadClaim.WithClaimBehavior(() => string.Empty),
                InvalidDocNumberPayloadClaim.WithClaimBehavior(() => "     ")
            };

            foreach (IPayloadClaimsManager behavior in docNumberClaimBehaviors)
            {
                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("'DocNumber' no puede ser nulo ni vacío", exception.Message);
            }
        }
예제 #3
0
        public void InvalidFormatDocNumberWhenUserSigninRequestThrows()
        {
            IList <IPayloadClaimsManager> docNumberClaimBehaviors = new List <IPayloadClaimsManager>()
            {
                InvalidDocNumberPayloadClaim.WithClaimBehavior(() => "a"),
                InvalidDocNumberPayloadClaim.WithClaimBehavior(() => "abcdef"),
                InvalidDocNumberPayloadClaim.WithClaimBehavior(() => "A0b1C2d3e4f5g6H7"),
                InvalidDocNumberPayloadClaim.WithClaimBehavior(() => "$123456@123#456*"),
                InvalidDocNumberPayloadClaim.WithClaimBehavior(() => "97165682970991858533737047")
            };

            foreach (IPayloadClaimsManager behavior in docNumberClaimBehaviors)
            {
                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(@"'DocNumber' debe coincidir con el patrón", exception.Message);
            }
        }