public void Cleanup() { _repository = null; _service = null; _questions = null; _unitOfWork = null; _mockRepository = null; }
public void Initialize() { _mockRepository = new Mock<IRepository<Question>>(); var firstQuestion = new Question { QuestionId = 1, Difficulty = Difficulty.Hard, Rating = 5 }; var secondQuestion = new Question { QuestionId = 2, Difficulty = Difficulty.Hard, Rating = 3 }; var brief = new Brief { Difficulty = Difficulty.Hard, Rating = 5, QuestionText = "Who let the dog's out ?", Answer = "It wasn't me" }; var choice = new Choice { Difficulty = Difficulty.Hard, Rating = 5, QuestionText = "Who let the dog's out ?", Choices = "Me,You,All of us all are the culprits", Answers = "All of us all are the culprits", IsMultiplechoice = true }; _questions = new List<Question> { firstQuestion, secondQuestion, brief, choice }; _mockRepository.Setup(_ => _.Query()).Returns(_questions.AsQueryable()); _repository = _mockRepository.Object; _service = new QuestionService(_repository, _unitOfWork); }