且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

测试失败时"在解决方案&QUOT运行所有测试;用来

更新时间:2021-08-30 22:38:04

RouteTable.Routes 是静态的,因此将只每个AppDomain初始化一次。

RouteTable.Routes is static and therefore will only be initialized once per AppDomain.

所以,每次运行测试时间,你实际上是试图一次又一次重新注册相同的路线。

So every time you run a test, you are in effect trying to re-register the same routes over again.

您可能会更好过移动路线注册成 AssemblyInitialize 属性,以便它只会在整个测试运行开始运行一次。

You would probably be better off moving your route registration into an AssemblyInitialize attribute so it will only run once at the beginning of the entire test run.