Example #1
0
        public async Task <ActionResult> BuildResult()
        {
            Builder builder = new Builder(_location);

            ApplicationUser currentUser = await _userManager.GetUserAsync(HttpContext.User);

            string output = _location + @"\" + Guid.Parse(currentUser.Id).ToString() + @"\output";

            var resultBuildItems = builder.Build(output);

            var tester  = new TestPicker(output, Guid.Parse(currentUser.Id));
            var results = tester.Test();

            try
            {
                if (results != null)
                {
                    foreach (var element in results)
                    {
                        var buildItem = resultBuildItems.FirstOrDefault(s => s.Dir.Equals(element.Dir));

                        buildItem?.Tests.Add(element);

                        testRepo.Add(new TestContext(element.Name, element.Dir, element.Result,
                                                     Guid.Parse(currentUser.Id)));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewData["Message"] = "ERROR " + ex.Message + "  " + ex.InnerException;
            }


            return(PartialView("BuildResultView", resultBuildItems));
        }
Example #2
0
 /// <summary>
 /// Save test to db
 /// </summary>
 /// <param name="model"></param>
 public void Add(Test model)
 {
     model.IsActive = true;
     _testRepo.Add(model);
 }