public void SetCollectionShouldMapTypesToImplementations() { var strategyCollection = new StrategyCollection <IInlineElementConverter>(new List <IInlineElementConverter>()); var mockConverter = new FakeConverterWithAttribute(); object dummyObject = new Object(); strategyCollection.SetCollection(new List <IInlineElementConverter>() { mockConverter }); var strategy = strategyCollection.GetStrategyForType(dummyObject.GetType()); Assert.IsType(mockConverter.GetType(), strategy); }
void GetStrategyShouldThrowExceptionWhenTypeIsNotFound() { var strategyCollection = new StrategyCollection <IInlineElementConverter>(new List <IInlineElementConverter>()); var mockConverter = new FakeConverterWithAttribute(); object dummyObject = new Object(); strategyCollection.SetCollection(new List <IInlineElementConverter>() { mockConverter }); Assert.Throws <StrategyNotFoundException>(() => { var strategy = strategyCollection.GetStrategyForType(mockConverter.GetType()); }); }