Helix.Examples icon indicating copy to clipboard operation
Helix.Examples copied to clipboard

Replace FakeDb-based Navigation unit tests with mocks

Open sshushliapin opened this issue 5 years ago • 4 comments

Partially addresses #67. Replaces Header component FakeDb unit tests with Item mocks.

sshushliapin avatar Nov 04 '19 08:11 sshushliapin

Tests may look a bit awkward here. That's because this PR contains pure mocks. Usually AutoFixture helps to minimize the redundant code and make tests more readable (if used right ;)). I just did not want to put everything into a single PR... Please let me know if I should come up with another PR for that.

sshushliapin avatar Dec 23 '19 16:12 sshushliapin

I'm a bit ambivalent about item mocking as-is. It's more of a true unit test, but it's a lot of ceremony for developers to go through, creating utility classes just to mock an item, especially if they are new to the Item API. As I've said before, wish there were a solution which had the usage simplicity of FakeDb but was backed by mocks.

nickwesselman avatar Dec 23 '19 16:12 nickwesselman

Ok, got it. There are some thoughts why do I prefer to go with mocks: https://sshushliapin.github.io/blog/2019/12/25/switching-from-fakedb-to-mocks.html

I'll try do find advanced scenarios to make the diff more visible. Besides that, I don't think utils is a big problem. It's relatively simple and can be copied from project to project without any harm. At least I didn't notice that ;)

sshushliapin avatar Dec 25 '19 13:12 sshushliapin

I'm going to keep this open as a reminder that we need to revisit, even if it does require a utility class :-D

nickwesselman avatar Feb 05 '20 13:02 nickwesselman