Created
January 1, 2017 17:23
-
-
Save odytrice/243fe6c4bf14aedb584c3fc876b9fe42 to your computer and use it in GitHub Desktop.
Tests Ninject Bindings in an Automated Way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Application.Tests | |
{ | |
[TestClass] | |
public class BindingsTest | |
{ | |
[TestMethod] | |
public void TestBindings() | |
{ | |
//Create Kernel and Load Assembly Application.Web | |
var kernel = new StandardKernel(); | |
kernel.Load(new Assembly[] { Assembly.Load("Application.Web") }); | |
var query = from types in Assembly.Load("Application.Core").GetExportedTypes() | |
where types.IsInterface | |
where types.Namespace.StartsWith("Application.Core.Interface") | |
select types; | |
foreach(var i in query.ToList()) | |
{ | |
kernel.Get(i); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment