public void Save(ExerciseQuestionUnitTest Test, UserModel User) { if (String.IsNullOrEmpty(Test.CreatedBy)) { Test.CreatedBy = User.Email; Test.CreatedDate = DateTime.Now; } _unitTestsRepository.Save(Test); }
public Boolean RunUnitTest(ExerciseQuestionUnitTest test, UserModel user) { var database = new Database(new DataAccess()); DataDifferencesModel differences; database.CheckAnswer(test.ExerciseQuestionId, test.SqlToCompare, user.UserId, out differences, test.SqlToCompare, test.SqlToRun); if (differences.Differences.Any()) { return(false); } else { return(true); } throw new ArgumentException("Invalid unit test type"); }
public void Save(ExerciseQuestionUnitTest Test) { // Does it already exist? var exists = Test.ExerciseQuestionUnitTestId != Guid.Empty; var context = new SqlConfidenceContext(); // Stop it saving any related objects Test.ExerciseQuestion = null; if (!exists) { Test.ExerciseQuestionUnitTestId = Guid.NewGuid(); context.ExerciseQuestionUnitTests.Add(Test); } else { context.ExerciseQuestionUnitTests.Attach(Test); context.Entry(Test).State = EntityState.Modified; } context.SaveChanges(); }
protected ExerciseQuestionUnitTest Create(ExerciseQuestionUnitTest Test) { return(Test); }