Skip to content

Commit 949f465

Browse files
committed
added test helper for ignoring methods marked as obsolete
1 parent b3b0b54 commit 949f465

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

LibGit2Sharp.Tests/MetaFixture.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ public void NoOptionalParametersinMethods()
307307
from t in Assembly.GetAssembly(typeof(IRepository))
308308
.GetExportedTypes()
309309
from m in t.GetMethods()
310+
where !m.IsObsolete()
310311
from p in m.GetParameters()
311312
where p.IsOptional
312313
select m.DeclaringType + "." + m.Name;
@@ -344,4 +345,13 @@ where p.IsOptional
344345
Assert.Equal("", sb.ToString());
345346
}
346347
}
348+
349+
internal static class TypeExtensions
350+
{
351+
internal static bool IsObsolete(this MethodInfo methodInfo)
352+
{
353+
var attributes = methodInfo.GetCustomAttributes(false);
354+
return attributes.Any(a => a is ObsoleteAttribute);
355+
}
356+
}
347357
}

0 commit comments

Comments
 (0)