【发布时间】:2018-02-16 11:58:41
【问题描述】:
我想从 NUNIT 2.x 升级到 3.x,但我有类似的测试
[TestCase("12345", ExpectedResult = "SUCCESS")]
[TestCase("invalidkey", ExpectedException = typeof(ArgumentException))]
[TestCase(null, ExpectedException = typeof(ArgumentNullException))]
public string ReturnsStatus(string filePath)
{
// Arrange
// Act
Tuple<string, string> result = service.Create(filePath);
// Assert
return result.Item1;
}
如何重写这种测试? NUNIT 3.x 没有 ExpectedException,这是我重构的原因。我不想分成 3 个测试。 谢谢。
【问题讨论】: