你的位置: 码友网首页 / 资讯源列表 / Unit testing Autofac registrations

关于[Unit testing Autofac registrations]的摘要:

We use Autofac as our IoC container at Konstrukt, so we can easily mock dependencies when unit testing, allow for more flexibility and general decoupling. All the normal stuff you would expect with IoC and dependency injection. Fore the most part, I’ve been very pleased with Autofac, and I’m a big fan of Dependency Injection and Inversion of Control. But, in a test-driven environment, where we mock out the dependencies further down the tree, we often get scenarios where we forget to register the types and interfaces in our modules (and container), only to be surprised by runtime errors and exceptions. Registering all classes with matching interfaces in dependent assemblies in an automated manner is not an option, as the interfaces aren’t always header interfaces, and we don’t want to add more registrations than we need, and a few other reasons.

原文地址: http://irisclasson.com/2019/09/07/unit-testing-autofac-registrations/

收录时间: 2019-09-11 浏览量: 24 分类: .NET

| 0 收藏 | 0