So I am investigating a unit test that is failing. The test fails because a function returns an "empty" value, which it only does if a certain ID is Null.
As you can see in the screenshot, my debugger says the ID is 1, which is also what I have mocked it up to be. When stepping through the Code though, it behaves as if it is null. It seems to behave as if it is null when I'm running the test normally as well.
If I do the same check in the mock setup code, the behavior is correct, it is also correct if I check it in the Test function. I wrote a test function in the class I'm testing and I'm quite certain the behavior was correct to start with, but ended up incorrect when I made some minor changes which I then reversed (code still behaving incorrectly though).
If it's relevant, we're running .net core 1.1 and entity framework core.
Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered