简体   繁体   English

如何在Asp.Net MVC集成测试中覆盖Structuremap注册表

[英]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.

相关问题 StructureMap ASP.net MVC不注入接口 - StructureMap ASP.net MVC Not Injecting Interface ASP.NET Core 6 MVC 集成测试-授权 - ASP.NET Core 6 MVC Integration Tests - Authorization 在Asp.net MVC 5中使用StructureMap扫描程序集 - Scanning Assemblys using StructureMap in Asp.net MVC 5 在ASP.NET MVC中使用Structuremap管理ObjectContext生存期 - Using Structuremap to manage ObjectContext Lifetime in ASP.NET MVC 无法在Asp.net MVC中使用StructureMap 4.5.2 - Can't using StructureMap 4.5.2 in Asp.net MVC 无法使用StructureMap在ASP.NET MVC中注入WCF服务依赖项 - Cannot inject WCF Service dependency in ASP.NET MVC with StructureMap ASP.Net MVC5 和 StructureMap4 - 简化方法 - ASP.Net MVC5 and StructureMap4 - Simplified Approach 合并ASP.NET MVC控制器依赖项(StructureMap) - Consolidating ASP.NET MVC Controller Dependencies (StructureMap) 如何使用structuremap asp.net mvc注册带有可选参数的可选装饰器或装饰器? - How to register an optional decorator or decorator with optional parameters using structuremap asp.net mvc? 如何从Asp.Net MVC 5依赖项解析器获取Structuremap IContainer实例 - How to get the Structuremap IContainer instance from Asp.Net MVC 5 Dependency Resolver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM