C#C
C#3y ago
37 replies
bluehour_

✅ System.NullReferenceException : Object reference not set to an instance of an object.

Hey guys, fairly new to .NET C# here. I'm trying to learn Unit Testing/Mocking at the moment. I found myself stuck on this error for days now that I'm thinking of just skipping it over and move on to another topic, but I really really wanna resolve this issue!

I setup a passing test but it's returning me an error 'System.NullReferenceException : Object reference not set to an instance of an object.' I'm so lost here, I've tried everything but nothing worked.

Please see photos for reference. I included the method I'm testing, mocking and the test result.
Screenshot_2023-08-30_152152.png
ss.png
Screenshot_2023-08-30_152358.png
Was this page helpful?