Is there a library of default unit tests for .NET interface implementations?
For example, I have a type which implements IDictionary, and I need test coverage to ensure that it does it properly. I just wondered if there is a repository of standard, reusable tests for this kind of thing anywhere; i开发者_如何学Pythonf there isn't, I might create one.
I doubt there's a publicly available .net one, but the Mono project might be a good place to start?
Whether they're testing "the contract" of the interface, or the specific implementation, I'm not sure, but there's certainly tests for the Dictionary class:
https://github.com/mono/mono/blob/master/mcs/class/corlib/Test/System.Collections.Generic/DictionaryTest.cs
I couldn't find anything which specifically met this need, so I made it. I've created a Github repo and added my IDictionary<TKey,TValue> test to it; hopefully people will fork and contribute more tests.
https://github.com/markrendle/InterfaceTests.Net
精彩评论