I am working on a project in which there are a lot of external service messages. A good way to describe this just slightly “hyperbolas” would be an application in which the system should send messages to the Flicker API, Facebook API, and Netflix API.
To support disabled scripts, logging problems, usability, customization, etc ... I experimented using an approach that heavily uses generics and expression trees. The end result is as follows:
Messenger<NetflixApi>.SendCustom( netflix => netflix.RecommendMovie("my message"));
In general, I am satisfied with the end result, but I feel that I made a mistake, or did not pay attention to the design project in terms of testing and disabled scripts.
During testing, whether automated, single or human-based, I implemented a factory object that initially uses DI to perform the correct action in "real mode" and used Mocks to provide a kind of sterile messenger that doesn’t do anything when in test mode.
I just saw or read that Mocks is used in pure TDD mode and not used to be a kind of dumb object. The approaches I've seen will revolve around caving in or mocking the HTTP communication features that all APIs depend on.
, , , , HTTP, , 3 (IService, ConcreteService, StubService) - PITA.
Mocks " ", - , .
: - ? Mocks ... ?
- - , , ?
?
.
# 1:
. //. , , .
, , , , .
, , , , .