Add test for interface coverage

Closes #546
This commit is contained in:
Keith Dahlby 2013-11-18 19:42:55 -06:00
Родитель 2e96549ccf
Коммит bedccca83f
1 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -108,6 +108,24 @@ namespace LibGit2Sharp.Tests
}
}
[Fact]
public void LibGit2SharpInterfacesCoverAllPublicMembers()
{
var methodsMissingFromInterfaces =
from t in Assembly.GetAssembly(typeof(IRepository)).GetExportedTypes()
where !t.IsInterface
where t.GetInterfaces().Any(i => i.Namespace == typeof(IRepository).Namespace)
let interfaceTargetMethods = from i in t.GetInterfaces()
from im in t.GetInterfaceMap(i).TargetMethods
select im
from tm in t.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance)
where !interfaceTargetMethods.Contains(tm)
select t.Name + " has extra method " + tm.Name;
Assert.Equal("", string.Join(Environment.NewLine,
methodsMissingFromInterfaces.ToArray()));
}
[Fact]
public void EnumsWithFlagsHaveMutuallyExclusiveValues()
{