Created
July 6, 2010 18:08
-
-
Save KevM/465717 to your computer and use it in GitHub Desktop.
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
| 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