通过 Spring.net 进行 TestContext?
我正在使用 Visual Studio UnitTesting 运行测试。我通过 Spring.net 注入一些属性。
因为我正在驱动基于数据的单元测试,所以我需要使用 TestContext
-Property 来访问给定的数据。
问题如下:如果我使用 TestContext
-Property Spring.Net 不再工作(我的属性不会被注入)。反之亦然(不要使用 TestContext
,Spring.net 可以工作)。
有没有办法同时使用两者?或者通过 Spring.net 填充我的 TestContext
?
添加代码:
public BusinessLogic BusinessLogic
{
set { _businessLogic = value; }
}
通过Spring设置。
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
应该从 MS VS 2008 设置。但它只能在 spring(属性被注入)或我的 TestContext
被注入时起作用。两者都不是...
I am running Test with the Visual Studio UnitTesting. I am injecting some Properties via Spring.net.
Because I am driving Data-based unit Tests I need to use the TestContext
-Property to access the Data given with.
The Problem is the following: If I use the TestContext
-Property Spring.Net doesn't work anymore (my properties are not getting injected). The same vice versa (Do not user TestContext
, Spring.net does work).
Is there a way to use both? Or to fill my TestContext
via Spring.net?
Adding Code:
public BusinessLogic BusinessLogic
{
set { _businessLogic = value; }
}
is set via Spring.
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
should be set from MS VS 2008. But it just works either spring (the property is injected) OR my TestContext
is injected. Not both...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论