[InlineData(Guid.Empty)]
[InlineData("00000000-0000-0000-0000-000000000000")]
[Theory]
public async Task Get_ValidateInput(Guid Id)
{ ... }
[InlineData(Guid.Empty)]
给出了编译时错误:
CS0182 - An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type.
[InlineData("00000000-0000-0000-0000-000000000000")]
给出运行时错误:
Specified method not supported.
答案 0 :(得分:0)
解决方法!
[InlineData(null)] //null
[InlineData("00000000-0000-0000-0000-000000000000")] //Empty Guid
[InlineData("")] //Empty string
[Theory]
public async Task Get_ValidateInput(object Id)
{
//test
}