MbUnit (gallio) 和 Visual Studio.Net 测试未完成或调试
我正在将 Gallio\MbUnit 3.1 与 ReSharper 和 Visual Studio 2008 一起使用。除了这种类型的测试之外,一切都运行良好:
[Test]
[Row("test@badEmail@_test.com")]
[Row("test@badEmail@_test.")]
public void IsValidEmail_Invalid_Emails_Should_Return_False(string invalidEmail)
{
Assert.IsFalse(AppHelper.IsValidEmail(invalidEmail),
"Email validation failed for " + invalidEmail);
}
仅当我传入参数(例如“字符串 invalidEmail”)时,测试才会完成或进入调试模式。如果我删除该参数,它似乎可以正常工作。
如果我有的话,它将运行测试:
[Test]
public void IsValidEmail_Invalid_Emails_Should_Return_False()
{
var invalidName = test@badEmail@_test.com";
Assert.IsFalse(AppHelper.IsValidEmail(invalidEmail),
"Email validation failed for " + invalidEmail);
}
我很欣赏可能有更好的方法来实现此测试,但我正在尝试通过一本书来完成,这就是它解释事物的方式。
任何帮助表示赞赏。
戴维
I'm using Gallio\MbUnit 3.1 with ReSharper and Visual Studio 2008. Everything is working well except this type of test:
[Test]
[Row("test@badEmail@_test.com")]
[Row("test@badEmail@_test.")]
public void IsValidEmail_Invalid_Emails_Should_Return_False(string invalidEmail)
{
Assert.IsFalse(AppHelper.IsValidEmail(invalidEmail),
"Email validation failed for " + invalidEmail);
}
The test doesn't complete or go in to debug mode only when I pass in a parameter E.g. 'string invalidEmail'. If I remove that prameter it seems to work normally.
It will run the test if I have:
[Test]
public void IsValidEmail_Invalid_Emails_Should_Return_False()
{
var invalidName = test@badEmail@_test.com";
Assert.IsFalse(AppHelper.IsValidEmail(invalidEmail),
"Email validation failed for " + invalidEmail);
}
I appreciate that there may be better ways to achieve this test but I'm trying to work my way through a book and this is how it's explaining things.
Any help is appreciated.
Davy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,测试看起来确实没问题。
编辑:我尝试使用 Gallio v3.2 build 381 和 ReSharper v5.0 build 1645 运行您的测试,它似乎运行良好。
您使用的是哪个版本的 Gallio 和 ReSharper?
您还可以尝试使用 TestDriven.Net 在 Visual Studio 中运行测试。有一个免费的个人版本,效果非常好。我发现它比使用 ReSharper 测试运行程序更有效。
Well, the test definitely looks ok.
Edit: I tried running your test using Gallio v3.2 build 381 and ReSharper v5.0 build 1645 and it seems to run fine.
Which versions of Gallio and ReSharper are you using?
You might also try using TestDriven.Net to run your tests in Visual Studio. There's a free personal edition that works quite well. I find it more efficient than using the ReSharper test runner.