Ejemplo n.º 1
0
        public void ReturnFailureForInValidUri()
        {
            UriValidator      validator         = new UriValidator();
            ValidationResults validationResults = validator.Validate("foo");

            Assert.IsFalse(validationResults.IsValid);
        }
Ejemplo n.º 2
0
		public void ReturnSuccessForEmptyString()
		{
			UriValidator validator = new UriValidator();
			ValidationResults validationResults = validator.Validate(null);

			Assert.IsTrue(validationResults.IsValid);
		}
Ejemplo n.º 3
0
		public void ReturnSuccessForValidUri()
		{
			UriValidator validator = new UriValidator();
			ValidationResults validationResults = validator.Validate("http://foo");

			Assert.IsTrue(validationResults.IsValid);
		}
Ejemplo n.º 4
0
		public void ReturnFailureForInValidUri()
		{
			UriValidator validator = new UriValidator();
			ValidationResults validationResults = validator.Validate("foo");

			Assert.IsFalse(validationResults.IsValid);
		}
Ejemplo n.º 5
0
        public void ReturnSuccessForEmptyString()
        {
            UriValidator      validator         = new UriValidator();
            ValidationResults validationResults = validator.Validate(null);

            Assert.IsTrue(validationResults.IsValid);
        }
Ejemplo n.º 6
0
        public void ReturnSuccessForValidUri()
        {
            UriValidator      validator         = new UriValidator();
            ValidationResults validationResults = validator.Validate("http://foo");

            Assert.IsTrue(validationResults.IsValid);
        }
Ejemplo n.º 7
0
            internal static void Validate(EpcisEvent evt)
            {
                evt.Epcs.ForEach(e => UriValidator.Validate(e.Id));

                if (IsAddOrDeleteAggregation(evt) && !evt.Epcs.Any(x => x.Type == EpcType.ParentId)) // TCR-7 parentID is Populated for ADD or DELETE Actions in Aggregation Events
                {
                    throw new EpcisException(ExceptionType.ValidationException, "TCR-7: parentID must be populated for ADD or DELETE aggregation event.");
                }
            }
Ejemplo n.º 8
0
        public void RegexURIFail1()
        {
            bool   not_expected        = true;
            string uri                 = "https://www.confirmit.com/logincallback";
            IEnumerable <string> rules = new List <string>(new[] {
                @"@https:\/\/[\w]+.confirmit\.com\/[\w]+\/logincallback"
            });

            bool result = UriValidator.Validate(uri, rules);

            Assert.AreNotEqual(not_expected, result);
        }
Ejemplo n.º 9
0
        public void WildcardURIFail2()
        {
            bool   not_expected        = true;
            string uri                 = "https://www.confirmit.com/www/something/logincallback";
            IEnumerable <string> rules = new List <string>(new[] {
                "https://*.confirmit.com/*/logincallback"
            });

            bool result = UriValidator.Validate(uri, rules);

            Assert.AreNotEqual(not_expected, result);
        }
Ejemplo n.º 10
0
        public void AbsoluteRuleMethod_No2()
        {
            UriValidator validator = new UriValidator();

            string[] googleRules = new[] {
                "https://www.google.com/webapp/logincallback" // absolute rule
            };

            var result = validator.Validate(@"https://www.google.com/webapp/logincallback/", googleRules);

            Assert.AreEqual(result, false);
        }
Ejemplo n.º 11
0
        public void WildcardRuleMethod_No3()
        {
            UriValidator validator = new UriValidator();

            string[] confirmitRules = new[] {
                "https://*.confirmit.com/*/logincallback" // wildcard rule
            };

            var result = validator.Validate(@"https://confirmit.com/logincallback", confirmitRules);

            Assert.AreEqual(result, false);
        }
Ejemplo n.º 12
0
        public void RegexRuleMethod_No1()
        {
            UriValidator validator = new UriValidator();

            string[] aspRules = new[] {
                @"@https://([\w-]+\.)*asp\.net\/logincallback" // literal regex rule
            };

            var result = validator.Validate(@"https://www.asp.net/webapp/login", aspRules);

            Assert.AreEqual(result, false);
        }
Ejemplo n.º 13
0
        public void RegexRuleMethod_No2()
        {
            UriValidator validator = new UriValidator();

            string[] confirmitRules = new[] {
                @"@https://([\w-]+\.)*confirmit\.com\/logincallback" // literal regex rule
            };

            var result = validator.Validate(@"https://confirmit.com/logincallback", confirmitRules);

            Assert.AreEqual(result, true);
        }
Ejemplo n.º 14
0
        public void AbsoluteURIFail()
        {
            //setup
            bool   not_expected        = true;
            string uri                 = "https://app.test.com/auth/logincallback";
            IEnumerable <string> rules = new List <string>(new[] {
                "https://app.confirmit.com/auth/logincallback"
            });

            bool result = UriValidator.Validate(uri, rules);

            Assert.AreNotEqual(not_expected, result);
        }
Ejemplo n.º 15
0
        public void WildcardRuleMethod_No1()
        {
            UriValidator validator = new UriValidator();

            string[] githubRules = new[] {
                "https://*.github.com/*/logincallback", // wildcard rule
                "https://*.github.com/webapp/login"     // wildcard rule
            };

            var result = validator.Validate(@"https://www.github.com/webapp/login", githubRules);

            Assert.AreEqual(result, true);
        }
Ejemplo n.º 16
0
        public void AbsoluteURISuccess()
        {
            //setup
            bool   expected            = true;
            string uri                 = "https://app.confirmit.com/auth/logincallback";
            IEnumerable <string> rules = new List <string>(new[] {
                "https://app.confirmit.com/auth/logincallback"
            });

            //action
            bool result = UriValidator.Validate(uri, rules);

            //assert
            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 17
0
 private static void EnsureDestinationIsValidURI(Subscription request) => UriValidator.Validate(request.Destination, true);