public void GetAnswersByQuestionId_InvalidArguments(int questionId) { // Arrange SOVAContext databaseContext = new SOVAContext(_connectionString); AnswerRepository answerRepository = new AnswerRepository(databaseContext); // Act IEnumerable <Answer> answers = answerRepository.GetAnswersForQuestionById(questionId); // Assert Assert.Null(answers); }
public void GetAnswersByQuestionId_ValidArguments() { // Arrange SOVAContext databaseContext = new SOVAContext(_connectionString); AnswerRepository answerRepository = new AnswerRepository(databaseContext); int questionId = 19; // Act IEnumerable <Answer> answers = answerRepository.GetAnswersForQuestionById(questionId); // Assert Assert.All(answers, (answer) => Assert.Equal(questionId, answer.ParentId)); }
public void GetAnswersByQuestionId_IncludesSubmission() { // Arrange SOVAContext databaseContext = new SOVAContext(_connectionString); AnswerRepository answerRepository = new AnswerRepository(databaseContext); int questionId = 19; // Act IEnumerable <Answer> answers = answerRepository.GetAnswersForQuestionById(questionId); // Assert Assert.All(answers, (a) => { Assert.NotNull(a.Submission); Assert.NotNull(a.Accepted); Assert.NotNull(a.ParentId); }); }