コード例 #1
0
        public void GitHubQuery_PingNoHost_Test()
        {
            //Arrange
            bool result = false;

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

            //Assert
            Assert.IsFalse(result);
        }
コード例 #2
0
        public void GitHubQuery_PingLocal_Test()
        {
            //Arrange
            bool result = false;

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

            //Assert
            Assert.IsTrue(result);
        }
コード例 #3
0
        public void GitHubQuery_QueryResult_Test()
        {
            //Arrange
            GitHubQuery gitHubQuery = new GitHubQuery();

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

            //Assert
            Assert.IsTrue(adhcServiceJsonResult != null);
        }
コード例 #4
0
        public void GitHubQuery_PingAssert_Test()
        {
            //Arrange
            bool result = false;

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

            //Assert
            Assert.IsFalse(result);
        }
コード例 #5
0
        public void GitHubQuery_PingHostName_Test()
        {
            //Arrange
            bool result = false;

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

            //Assert
            Assert.IsTrue(result);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        /**********************************************************************************************//**
        * \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());
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: anurse/querygen
        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}"));
        }