3 ms·
You're talking about mocking database calls though. In my line of work (insurance brokerage), we use lots of insurance APIs and they are sometimes very slow (+2
by frenchman99 7y ago
You're talking about mocking database calls though. In my line of work (insurance brokerage), we use lots of insurance APIs and they are sometimes very slow (+20 seconds / call) or completely down at random hours. There is simply no way around mocking those API calls if you want a fast and reliable testsuite.
- j88439h84 7y agoTake a look at the links at the top of the post. They discuss a great alternative to mocking slow services: fakes.
- redis_mlc 7y ago> or completely down at random hours Also describes "dinosaur payment company" API sandboxes (stage). So we end up testing against the production API with a staff member's credit card - well if we want to deploy any time soon. Or I guess you could mock and cross your fingers that they haven't changed the API recently without telling you. Payment APIs are the most solid, but that's a low bar considering the state of third-party APIs in the real world. If it wasn't hard for enterprises to build and manage APIs, then Google Apigee and Mulesoft wouldn't be worth billions.
- scarface74 7y agoYes we can mock databases and queries in C# var oldMen = from p in context.Persons where p.Sex == “M” && p.Age > 65; “context” could be an Entity Framework context that would generate sql at runtime, an IMongoQueryable that would generate MongoQuery at runtime or an in memory List<Person> that would generate the equivalent foreach loop with an if condition (overly simplified) while running your tests.