[英]How to override Structuremap registry in integration tests for Asp.Net MVC
I am writting UI Integration tests/Acceptance tests for a MVC website. 我正在为MVC网站编写UI集成测试/验收测试。 I want to be able to override the repository classes at run time for these tests with my InMemory repository classes. 我希望能够在运行时使用InMemory存储库类覆盖这些测试的存储库类。
I am using Structuremap default configuration and the thing that I want to achieve is to tell my acceptance tests to use InMemory Repositories instead of the default ones that are configured. 我正在使用Structuremap的默认配置,我要实现的目标是告诉验收测试使用InMemory存储库而不是已配置的默认存储库。
I am not sure how this can be done? 我不确定该怎么做? Can you please guide me? 你能指导我吗?
I am not interested in using In Memory DBs or No SQL DBs for this purpose so kindly advice me how can I change the class instance at run time. 我对为此目的使用“内存数据库”或“无SQL数据库”不感兴趣,因此建议我如何在运行时更改类实例。
The documentation gives some examples of how to do this. 该文档提供了一些有关如何执行此操作的示例。
http://docs.structuremap.net/ChangingConfigurationAtRuntime.htm http://docs.structuremap.net/ChangingConfigurationAtRuntime.htm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.