매개 변수에 사용자 지정 특성이 연결되어 있는지 어떻게 결정합니까? 메서드의 특성에 액세스하는 방법 매개 변수
나는이 테스트 케이스가 통과 할 것이라고 생각 :[TestCase("")]
public void TestParameterAttribute([NotRequired]string theString)
{
var result = false;
foreach (var attribute in theString.GetType().GetCustomAttributes(true))
{
if (attribute.GetType() == (typeof(NotRequiredAttribute)))
{
result = true;
}
}
Assert.That(result, Is.True);
}
아 덕분 사람, 즉 쿨입니다. –