having trouble with moq after updating project which based on .netcore beta 5 and updated to rc1. Before updating, test was worked and now I have error: "An expression tree may not contain a call or invocation that uses optional arguments". Help me please to solve it.
[Fact]
public async void ReturnPostUserAnswerResult()
{
// Arrange
var mockSet = new Mock<DbSet<QuestionsToUsers>>();
var _applicationDbContext = new Mock<ApplicationDbContext>();
_applicationDbContext.Setup(a => a.QuestionToUsers).Returns(mockSet.Object);
var controller = new UserQuizController(_applicationDbContext.Object);
// Act
var result = new QuestionsToUsers()
{
Answer = true,
QuestionID = 99,
TestpackID = 99,
Id = 99,
UserID = "TestUser"
};
await controller.PostUserAnswerResult(result);
mockSet.Verify(m => m.Add(It.IsAny<QuestionsToUsers>())); //here error
}
Aucun commentaire:
Enregistrer un commentaire