4 ms·
The fake is coupled to the "real" implementation of the interface. But the test that uses the fake is no longer coupled to the implementation of the fake/mock.
by ragnese 6y ago
The fake is coupled to the "real" implementation of the interface. But the test that uses the fake is no longer coupled to the implementation of the fake/mock.
Instead of counting how many times a method is called (mock), your test just gets to test the outcome of the overall operation (fake).
- srtjstjsj 6y ago> counting how many times That's an expectation which is an extra optional layer on top of mocking. The important difference between mock and fake is that a separate mock has to be created for every single test, but a fake needs only be created once for all tests that use the faked dependency.