void ILocalTestService.AddLocalTestTasks(string userName, string testsystemName, string testsystemUrl, List <string> browsers, List <string> testcases, List <string> languages) { Testsystem testsystem = _testsystemRepository.GetByName(testsystemName); Tester tester = _testerRepository.GetByName(userName); testsystem.Url = testsystemUrl; _testsystemRepository.Store(testsystem); Testsuite testsuite = new Testsuite { Description = "", Name = "Local " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), TestsystemFilter = testsystem }; _testsuiteRepository.Store(testsuite); int testsuiteId = testsuite.ID; List <int> testcaseIds = testcases.Select(t => _testcaseRepository.GetByType(t).ID).ToList(); List <int> browserIds = browsers.Select(t => _browserRepository.GetByName(t).ID).ToList(); List <int> languageIds = languages.Select(t => _languageRepository.GetByLanguageCode(t).ID).ToList(); _testsuiteRepository.SetTestcasesForTestsuite(testsuiteId, testcaseIds); _testsuiteRepository.SetBrowsersForTestsuite(testsuiteId, browserIds); _testsuiteRepository.SetLanguagesForTestsuite(testsuiteId, languageIds); TestJob testjob = new TestJob { Name = "A set of tests on " + testsystem.Url, ResultCode = TestState.Pending, Testsuite = testsuite, Testsystem = testsystem, Tester = tester, StartedAt = DateTime.Now, JobType = JobType.Localtesttool }; ITestJobManager testJobManager = new TestJobManager(testjob); ICollection <WorkItem> workItems = (from testcase in testsuite.Testcases from browser in testsuite.Browsers from language in testsuite.Languages select new WorkItem(testJobManager) { Testcase = testcase, Browser = browser, Language = language, Testsystem = testsystem, Tester = tester }).ToList(); _testPool.AddTestJob(testJobManager, workItems); }
void ISettingsService.SetTestcasesForTestsuite(int testsuiteId, ICollection <int> testcases) { _testsuiteRepository.SetTestcasesForTestsuite(testsuiteId, testcases); }