Unit test error in AddItemAsync
nbarbettini opened this issue · comments
Feedback:
When running Unit tests: there is an error in test execution, but the test project doesn’t say anything more than this generic error message. (I tried in both VS Code and VS 2017 15.4)
Message: System.NullReferenceException : Object reference not set to an instance of an object.
I tracked it down to the second parameter of the AddItemAsync method, which expects a user but is getting passed a null value from the test method.
Yes, this is an error, I got a comment on this page:
https://windsting.github.io/little-aspnetcore-book/book/chapters/automated-testing/unit-testing.html
I checked the code it seems caused by the null
in this line:
await service.AddItemAsync(new NewTodoItem { Title = "Testing?" }, null);
Fixed in fbddcae