Reputation: 5364
How to know if there is a class name repeated in different namespaces in Visual Studio? Obviously I'm not looking to test every class name manually.
Upvotes: 0
Views: 108
Reputation: 1503779
I'd just write a unit test that uses reflection. Something like:
var duplicateGroups = typeof(SomeTypeInAssembly).GetTypes()
.GroupBy(t => t.Name)
.Where(g => g.Count() != 1);
// Assert that duplicateGroups is empty
Exactly how you assert that the collection is empty will depend on your test framework - you'll also want to make sure that when the test does fail, it gives you a useful failure message, ideally a list of the types in each group.
Upvotes: 4