Esempio n. 1
0
        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>());
        }
Esempio n. 2
0
        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>());
        }
Esempio n. 3
0
 public static IApiExplorer GetApiExplorer(this DefaultServices services)
 {
     return(services.GetServiceOrThrow <IApiExplorer>());
 }
Esempio n. 4
0
 public static IHttpActionInvoker GetActionInvoker(this DefaultServices services)
 {
     return(services.GetServiceOrThrow <IHttpActionInvoker>());
 }
Esempio n. 5
0
 public static IHttpActionSelector GetActionSelector(this DefaultServices services)
 {
     return(services.GetServiceOrThrow <IHttpActionSelector>());
 }
Esempio n. 6
0
 public static IHttpControllerTypeResolver GetHttpControllerTypeResolver(this DefaultServices services)
 {
     return(services.GetServiceOrThrow <IHttpControllerTypeResolver>());
 }
Esempio n. 7
0
 public static IAssembliesResolver GetAssembliesResolver(this DefaultServices services)
 {
     return(services.GetServiceOrThrow <IAssembliesResolver>());
 }
Esempio n. 8
0
 /// <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>());
 }
Esempio n. 9
0
 public static ModelMetadataProvider GetModelMetadataProvider(this DefaultServices services)
 {
     return(services.GetServiceOrThrow <ModelMetadataProvider>());
 }