I still can see how we now can know if the Lhasa Apso has barked or not and if so, how many times it did that.
(aka: if we did call the tests for that.)
I can imagine to have extra fields in the struct for measuring the access to it, but at what costs?
It's probably better to look at the code-coverage to see if it is "touched".
actually the test of text is designed to component which has type Dog as dependency. Lhasa Apso is a “concrete” implementation of Dog, therefore you don’t need to mock a Dog to test its methods, you can test them directly :)
I know you can test directly, but still I won't have any information about how many times a Lhasa was barking with your example. You will only know that from the fake-dog, and that's the one we're the least interested in, right?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I still can see how we now can know if the Lhasa Apso has barked or not and if so, how many times it did that.
(aka: if we did call the tests for that.)
I can imagine to have extra fields in the struct for measuring the access to it, but at what costs?
It's probably better to look at the code-coverage to see if it is "touched".
actually the test of text is designed to component which has type Dog as dependency. Lhasa Apso is a “concrete” implementation of Dog, therefore you don’t need to mock a Dog to test its methods, you can test them directly :)
I know you can test directly, but still I won't have any information about how many times a Lhasa was barking with your example. You will only know that from the fake-dog, and that's the one we're the least interested in, right?