private async Task <AnswersService> ArrangeServiceAsync() { ApplicationDbContext db = GetDb(); var repository = new EfDeletableEntityRepository <Answer>(db); var questionRepository = new EfDeletableEntityRepository <Question>(db); await this.AddQuestionAsync(questionRepository); var service = new AnswersService(repository, questionRepository); await service.CreateAsync("title", "content", this.stylist.Id, this.client.Id, this.question.Id); return(service); }
public async Task CheckGettingAnswersDetailsAsync() { ApplicationDbContext db = GetDb(); var repository = new EfDeletableEntityRepository <Answer>(db); var questionRepository = new EfDeletableEntityRepository <Question>(db); await this.AddQuestionAsync(questionRepository); var service = new AnswersService(repository, questionRepository); var answerId = await service.CreateAsync("title", "content", this.stylist.Id, this.client.Id, this.question.Id); var answerResult = await service.GetAnswerDetailsAsync <TestAnswerModel>(answerId); Assert.Equal(answerId, answerResult.Id); }