Skip to content

Instantly share code, notes, and snippets.

@odytrice
Created January 1, 2017 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save odytrice/243fe6c4bf14aedb584c3fc876b9fe42 to your computer and use it in GitHub Desktop.
Save odytrice/243fe6c4bf14aedb584c3fc876b9fe42 to your computer and use it in GitHub Desktop.
Tests Ninject Bindings in an Automated Way
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