public void WhenGettingOrThrowUnknowServiceThenThrowsInvalidOperationException() { ProcessorConfiguration config = new ProcessorConfiguration(); DefaultServices services = new DefaultServices(config); services.Replace(typeof(ICommandHandlerActivator), null); // Act & Assert Assert.Throws<InvalidOperationException>(() => services.GetServiceOrThrow<ICommandHandlerActivator>()); }
public void WhenGettingOrThrowUnknowServiceThenThrowsInvalidOperationException() { ProcessorConfiguration config = new ProcessorConfiguration(); DefaultServices services = new DefaultServices(config); services.Replace(typeof(ICommandHandlerActivator), null); // Act & Assert Assert.Throws <InvalidOperationException>(() => services.GetServiceOrThrow <ICommandHandlerActivator>()); }
public static IApiExplorer GetApiExplorer(this DefaultServices services) { return(services.GetServiceOrThrow <IApiExplorer>()); }
public static IHttpActionInvoker GetActionInvoker(this DefaultServices services) { return(services.GetServiceOrThrow <IHttpActionInvoker>()); }
public static IHttpActionSelector GetActionSelector(this DefaultServices services) { return(services.GetServiceOrThrow <IHttpActionSelector>()); }
public static IHttpControllerTypeResolver GetHttpControllerTypeResolver(this DefaultServices services) { return(services.GetServiceOrThrow <IHttpControllerTypeResolver>()); }
public static IAssembliesResolver GetAssembliesResolver(this DefaultServices services) { return(services.GetServiceOrThrow <IAssembliesResolver>()); }
/// <summary> /// Controller activator is used to instantiate an <see cref="IHttpController"/>. /// </summary> /// <returns> /// An <see cref="IHttpControllerActivator"/> instance or null if none are registered. /// </returns> public static IHttpControllerActivator GetHttpControllerActivator(this DefaultServices services) { return(services.GetServiceOrThrow <IHttpControllerActivator>()); }
public static ModelMetadataProvider GetModelMetadataProvider(this DefaultServices services) { return(services.GetServiceOrThrow <ModelMetadataProvider>()); }