Exemplo n.º 1
0
        public void CreateErrorMessage()
        {
            Assert.Throws <ArgumentOutOfRangeException>(() => ResultsFactory.CreateErrorMessage(200, "Test"));
            var result = ResultsFactory.CreateErrorMessage(300, "Test");

            Assert.IsNotNull(result);
        }
Exemplo n.º 2
0
        public ActionResult <List <IAlgoResultEntity> > Get(string path)
        {
            var pathVar = path.Split('_');
            int exeID;
            int projectID;
            List <AlgorithmEntity> algos = new List <AlgorithmEntity>();

            path = _filesService.GetFullPath(path);

            if (!System.IO.Directory.Exists(path))
            {
                return(NotFound());
            }

            if (pathVar.Length != 2 || !int.TryParse(pathVar[1], out exeID) || !int.TryParse(pathVar[0], out projectID))
            {
                return(NotFound());
            }

            if (!_filesService.IsFolderAllowed(path, _accessor.HttpContext.User.Identity.Name))
            {
                return(Forbid());
            }

            if (projectID > 0)
            {
                algos = _projectsRepository.GetAlgorithmsByExecution(exeID);
            }
            else
            {
                algos.Add(_projectsRepository.GetAlgorithmByAlgoExeId(exeID));
            }

            List <IAlgoResultEntity> results = ResultsFactory.GetResults(algos, path);

            return(Ok(results));
        }
Exemplo n.º 3
0
 public MethodCaller(AjaxHandler executionContext, IMkJson json)
 {
     this._executionContext = executionContext;
     this._resultsFactory = new ResultsFactory(json);
     this._parametersFactory = new ParametersFactory(json);
 }