Beispiel #1
0
        public void ValidarUrlTest()
        {
            string url = @"https://stackoverflow.com/questions/7578857/how-to-check-whether-a-string-is-a-valid-http-url";

            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            url = @"http://stackoverflow.com/questions/7578857/how-to-check-whether-a-string-is-a-valid-http-url";
            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            url = @"https://www.stackoverflow.com/questions/7578857/how-to-check-whether-a-string-is-a-valid-http-url";
            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            url = @"http://www.stackoverflow.com/questions/7578857/how-to-check-whether-a-string-is-a-valid-http-url";
            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar CPF", this.GetType())));

            url = @"HTTPS://DEV.TJSP.JUS.BR/RHF/MED/";
            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            url = @"https://qa.tjsp.jus.br/RHF/MED/";
            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            url = @"https://uat.tjsp.jus.br/RHF/MED/";
            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            url = @"https://hom.tjsp.jus.br/RHF/MED/";
            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            url = @"https://www.tjsp.jus.br/RHF/MED/";
            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));
            url = @"https://www.google.com.br/search?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#safe=active&q=validar+url+maior+que+2054+caracteres+regex+";
            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            url = @"http:/www.stackoverflow.com/questions/7578857/how-to-check-whether-a-string-is-a-valid-http-url";
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            url = @"https://www.google.com.br/search?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#safe=active&q=validar+url+c%23+Uri.TryCreatesearch?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#safe=active&q=validar+url+c%23+Uri.TryCreatesearch?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#safe=active&q=validar+url+c%23+Uri.TryCreatesearch?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#safe=active&q=validar+url+c%23+Uri.TryCreatesearch?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#safe=active&q=validar+url+c%23+Uri.TryCreatesearch?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#safe=active&q=validar+url+c%23+Uri.TryCreatesearch?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#safe=active&q=validar+url+c%23+Uri.TryCreatesearch?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#safe=active&q=validar+url+c%23+Uri.TryCreatesearch?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#safe=active&q=validar+url+c%23+Uri.TryCreatesearch?q=validar+cnpj+000000000000000&rlz=1C1CHZL_pt-BRBR722BR722&oq=validar+cnpj+000000000000000&aqs=chrome..69i57.10055j0j7&sourceid=chrome&ie=UTF-8&safe=active#srf";
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));

            url = @"www.stackoverflow.com/questions/7578857/how-to-check-whether-a-string-is-a-valid-http-url";
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarUrl(url, "Validar URL", this.GetType())));
        }