Exemple #1
0
        /// <summary>
        /// Index function for Testing View.
        /// </summary>
        /// <param name="testsystem">ID of the Testsystem</param>
        /// <param name="testsuite">ID of the Testsuite</param>
        /// <returns>A Testing Index View</returns>
        public ActionResult Index(int testsystem = 0, int testsuite = 0)
        {
            if (testsystem == 0 && Session["testsystem"] != null)
            {
                testsystem = (int)Session["testsystem"];
            }
            if (testsuite == 0 && Session["testsuite"] != null)
            {
                testsuite = (int)Session["testsuite"];
            }

            IList <TestsystemModel> testsystems = Mapper.Map <IList <TestsystemModel> >(_testViewerService.GetTestsystems());

            ViewBag.LstTestsystems = testsystems;
            if (testsystem == 0 && testsystems.Count > 0)
            {
                TestsystemModel dev = testsystems.FirstOrDefault(t => t.Name == "dev");
                testsystem = dev != null ? dev.ID : testsystems[0].ID;
            }

            IList <TestsuiteModel> testsuites = Mapper.Map <IList <TestsuiteModel> >(_testViewerService.GetTestSuites(testsystem));

            ViewBag.LstTestsuites = testsuites;
            if ((testsuite == 0 || testsuites.All(t => t.ID != testsuite)) && testsuites.Count > 0)
            {
                TestsuiteModel objMain = testsuites.FirstOrDefault(t => t.Name == RegtestingMvcConfiguration.Defaulttestsuite);
                testsuite = objMain != null ? objMain.ID : testsuites[0].ID;
            }

            Session["testsystem"] = testsystem;
            Session["testsuite"]  = testsuite;

            ViewBag.CurrentTestsuite  = testsuites.Single(t => t.ID == testsuite);
            ViewBag.CurrentTestsystem = testsystems.Single(t => t.ID == testsystem);

            return(View());
        }