public QuizRepositoryTest() { _context = A.Fake<EasyTeachContext>(); _quizRepository = new QuizRepository(_context); _quizDto = new QuizDto { QuizId = QuizId, Questions = new List<QuestionDto>()}; }
public void GetAllQuizes_ReturnedAllQuizes() { var quiz = new QuizDto { QuizId = 1, Name = "Name", Description = "Description" }; IDbSet<QuizDto> quizes = new FakeDbSet<QuizDto> { quiz }; A.CallTo(() => _context.Quizes).Returns(quizes); var result = _quizRepository.GetAllQuizes().Result; Assert.NotNull(result); Assert.True(result.Count() == 1); Assert.True(result.Any(x => x.QuizId == quiz.QuizId && x.Name == quiz.Name && x.Description == quiz.Description)); }