public void GitHubQuery_PingNoHost_Test()
        {
            //Arrange
            bool result = false;

            //Act
            result = GitHubQuery.CheckByPing("");

            //Assert
            Assert.IsFalse(result);
        }
        public void GitHubQuery_PingLocal_Test()
        {
            //Arrange
            bool result = false;

            //Act
            result = GitHubQuery.CheckByPing("127.0.0.1", 2000);

            //Assert
            Assert.IsTrue(result);
        }
        public void GitHubQuery_QueryResult_Test()
        {
            //Arrange
            GitHubQuery gitHubQuery = new GitHubQuery();

            //Act
            ADHCServiceJsonResult adhcServiceJsonResult = gitHubQuery.RunQuery();

            //Assert
            Assert.IsTrue(adhcServiceJsonResult != null);
        }
        public void GitHubQuery_PingAssert_Test()
        {
            //Arrange
            bool result = false;

            //Act
            result = GitHubQuery.CheckByPing("127.0.0.1", -1);

            //Assert
            Assert.IsFalse(result);
        }
        public void GitHubQuery_PingHostName_Test()
        {
            //Arrange
            bool result = false;

            //Act
            result = GitHubQuery.CheckByPing("www.google.com");

            //Assert
            Assert.IsTrue(result);
        }
        public void GitHubQuery_PingWEB_Test()
        {
            //Arrange
            bool        result      = false;
            GitHubQuery gitHubQuery = new GitHubQuery();

            //Act
            result = GitHubQuery.CheckByPing("8.8.8.8", 2000);

            //Assert
            Assert.IsTrue(result);
        }
        /**********************************************************************************************//**
        * \fn  public ActionResult QueryResult()
        *
        * \brief   Queries the result
        *
        * \author  Delmiro Paes
        *
        * \returns A response stream to send to the QueryResult View.
        **************************************************************************************************/
        public ActionResult QueryResult()
        {
            ViewBag.Message = "Resultado da consulta ao GitHub.";

            GitHubQuery gitHubQuery = new GitHubQuery();

            //TODO: Check query result.
            ADHCServiceJsonResult adhcServiceJsonResult = gitHubQuery.RunQuery();

            // Fail.
            if (null == adhcServiceJsonResult)
            {
                return(View("Error"));
            }

            ViewBag.ADHCServiceJsonResult = adhcServiceJsonResult;

            return(View());
        }
Esempio n. 8
0
        private static GitHubQuery GenerateAreaQuery(QueryDefinition queryDefinition, QueryArea area)
        {
            string baseUrl;
            string areaFilter;

            if (area.Repositories.Count > 1)
            {
                baseUrl    = "https://github.com/search?q=";
                areaFilter = string.Join(" ", area.Repositories.Select(r => $"repo:{r}")) + " ";
            }
            else
            {
                baseUrl    = $"https://github.com/{area.Repositories[0]}/issues?q=";
                areaFilter = "";
            }

            if (!string.IsNullOrEmpty(area.Label))
            {
                areaFilter += $"label:{area.Label}";
            }

            return(GitHubQuery.Create(queryDefinition.Name, baseUrl, $"{queryDefinition.QueryText} {areaFilter}"));
        }