public async Task Test_Create_Question() { var newQuestion = new Question { Id = 1, Title = "Unit Test Question", UserId = 1, Text = "Question Text" }; var mockBaseRepo = new Mock <IBaseRepository <Question> >(); mockBaseRepo.Setup(m => m.CreateAsync(It.IsAny <Question>())) .ReturnsAsync(newQuestion); var questionRepo = new QuestionRepository(mockBaseRepo.Object); var dbQuestion = await questionRepo.CreateQuestionAsync(newQuestion); Assert.NotNull(dbQuestion); Assert.Equal(1, dbQuestion.Id); }