Exemplo n.º 1
0
        public Test CreateTest(int testId)
        {
            var test = _testRepository.GetDataById(testId).FirstOrDefault();

            if (test == null)
            {
                throw new Exception("Test not found.");
            }

            test.TestType = _testTypeRepository.GetDataById(test.TestTypeId).FirstOrDefault();

            test.ExpectedResults =
                (Collection <ExpectedResult>)_expectedResultRepository.GetDataByTestId(test.Id);

            foreach (var expResult in test.ExpectedResults)
            {
                if (expResult == null)
                {
                    continue;
                }
                if (expResult.AssertTypeId != null)
                {
                    expResult.AssertType = _assertTypeRepository.GetDataById((int)expResult.AssertTypeId)
                                           .FirstOrDefault();
                }
            }

            return(test);
        }
Exemplo n.º 2
0
 public static Test IncludeExpectedResults(this Test test, IExpectedResultRepository expectedResultRepository)
 {
     if (test.ExpectedResults != null)
     {
         return(test);
     }
     test.ExpectedResults = (ExpectedResultList)expectedResultRepository.GetDataByTestId(test.Id);
     return(test);
 }
Exemplo n.º 3
0
 public static Test IncludeExpectedResults(this Test test, IExpectedResultRepository expectedResultRepository)
 {
     if (test.ExpectedResults != null) return test;
     test.ExpectedResults = (ExpectedResultList) expectedResultRepository.GetDataByTestId(test.Id);
     return test;
 }
 public IQueryable <ExpectedResult> GetDataByTestId(int testId)
 {
     return(_dbRepository.GetDataByTestId(testId).AsQueryable());
 }