In order to return the updated value of resources.SingleOrDefault()
, you will need to use lambda expression in the arrangement, like this:
Mock.Arrange(() => context.Resources.SingleOrDefault())
.Returns(() => resources.SingleOrDefault());
Otherwise, when the context.Resources.SingleOrDefault()
method is called, the mock will return null, which is the value of the resources.SingleOrDefault()
call at the time of the arrangement.