/// <summary> /// Find the type of the adapter with the specified name and create it. /// </summary> protected static IAdapter CreateAdapter(string adapterTypeName) { if (string.IsNullOrEmpty(adapterTypeName)) { return(null); } var adapterType = TypeResolver.FindAdapterType(adapterTypeName); if (adapterType == null) { throw new NoSuchAdapterException(adapterTypeName); } if (!typeof(IAdapter).IsAssignableFrom(adapterType)) { throw new InvalidAdapterException(string.Format("Type '{0}' does not implement IAdapter and cannot be used as an adapter.", adapterTypeName)); } return(AdapterResolver.CreateAdapter(adapterType)); }
public void Align() { _serviceLocatorMock = new Mock <IServiceLocator>(); _sut = new AdapterResolver(_serviceLocatorMock.Object); }