Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save KevM/465717 to your computer and use it in GitHub Desktop.

Select an option

Save KevM/465717 to your computer and use it in GitHub Desktop.
using System;
using NUnit.Framework;
namespace StructureMap.Testing
{
[TestFixture]
public class getting_an_instance_of_a_type_with_an_unregistered_dependency
{
[Test]
public void should_describe_the_type_under_construction_in_the_thrown_exception()
{
var container = new Container(cfg => cfg.For<IMyType>().Use<MyType>());
typeof(StructureMapException).ShouldBeThrownBy(()=>container.GetInstance<IMyType>()).ShouldContainErrorMessage(typeof(MyType).Name);
}
}
public class MyType :IMyType
{
private readonly Type _type;
public MyType(Type type)
{
_type = type;
}
public Type Type
{
get { return _type; }
}
}
public interface IMyType {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment