Created
January 29, 2009 20:51
-
-
Save KevM/54733 to your computer and use it in GitHub Desktop.
This file contains 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
[Test] | |
public void Structure_map_should_use_the_last_in_configuration_for_a_type() | |
{ | |
var container = new Container(config => config.ForRequestedType<ILogger>().TheDefaultIsConcreteType<NullLogger>()); | |
container.GetInstance<UsesLogging>().Logger.ShouldBeOfType<NullLogger>(); | |
container.Configure(config => config.ForRequestedType<ILogger>().TheDefault.Is.ConstructedBy(s=>new Log4NetLogger(s.ParentType))); | |
container.GetInstance<UsesLogging>().Logger.ShouldBeOfType<Log4NetLogger>(); | |
} | |
public class UsesLogging | |
{ | |
public ILogger Logger { get; private set; } | |
public UsesLogging(ILogger logger) | |
{ | |
Logger = logger; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment