【发布时间】:2019-04-16 14:06:57
【问题描述】:
我在编写一些测试时想知道在使用 xUnit 测试时是否可以使用 by @microsoft 声明的 string.isempty。 (见下文)
我是一名编程专业的学生,我的老师建议尽可能使用 @microsofts 已定义的方法和常量。
我试过了,但它似乎没有用,所以我想我可能做错了什么。
[Theory]
[InlineData(string.Empty)]
[InlineData(null)]
[InlineData(" ")]
[InlineData(" ")]
[InlineData(" someRandomText")]
// ...
public void SetEmailaddress_WrongEmail_IllegalArgumentException(string data) // type of method that is being test, what kind of test, the expected outcome
{
//Assert
Assert.Throws<ArgumentException>(() => _l.Emailaddress = data);
}
提前致谢!
你好
【问题讨论】:
标签: c# unit-testing testing xunit.net