Created
March 19, 2010 18:14
-
-
Save RookieOne/337994 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
public interface ITranslator | |
{ | |
} | |
public class ClientATranslator : ITranslator | |
{ | |
} | |
public class ClientBTranslator : ITranslator | |
{ | |
} | |
[TestClass] | |
public class using_Add_All_Types_using_Name | |
{ | |
Container _container; | |
public void Setup() | |
{ | |
_container = new Container(); | |
_container.Configure(x => | |
x.Scan(s => | |
{ | |
s.TheCallingAssembly(); | |
s.AddAllTypesOf<ITranslator>().NameBy( | |
t => t.Name.Replace("Translator", "")); | |
})); | |
} | |
[TestMethod] | |
public void should_be_translator_for_clientA() | |
{ | |
Setup(); | |
var translator = _container.GetInstance<ITranslator>("ClientA"); | |
translator.ShouldBeType<ClientATranslator>(); | |
} | |
[TestMethod] | |
public void should_be_translator_for_clientB() | |
{ | |
Setup(); | |
var translator = _container.GetInstance<ITranslator>("ClientB"); | |
translator.ShouldBeType<ClientBTranslator>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment