public static IEnumerable<SitecoreService> SitecoreService() { var typeProvider = GetServicesControllerScanner(); var nameGenerator = new NamespaceQualifiedUniqueNameGenerator(DefaultHttpControllerSelector.ControllerSuffix); IServicesConfiguration servicesConfiguration = new ServicesSettingsConfigurationProvider(); var internalService = new SitecoreServices( typeProvider, nameGenerator, ResolveMetaDataBuilder(), servicesConfiguration); return new CachingSitecoreServices(internalService, new WebCacheAdapter()).Collection; }
public SitecoreServicesBehaviour() { _typeProvider = new Mock<ITypeProvider>(); _nameGenerator = new Mock<IControllerNameGenerator>(); _metadataBuilder = new Mock<IMetaDataBuilder>(); var servicesConfiguration = new Mock<IServicesConfiguration>(); _sut = new SitecoreServices( _typeProvider.Object, _nameGenerator.Object, _metadataBuilder.Object, servicesConfiguration.Object); _typeProvider .SetupGet(x => x.Types) .Returns(new[] { typeof(TestController), typeof(TestService) }.AsQueryable); _nameGenerator .Setup(x => x.GetName((It.IsAny<Type>()))) .Returns("foo.bar"); servicesConfiguration.SetupGet(x => x.Configuration) .Returns(new ServicesSettingsConfiguration { Services = new ServicesSettingsConfiguration.ServiceConfiguration() { Routes = new ServicesSettingsConfiguration.ServiceConfiguration.RouteConfiguration() { RouteBase = "/baseurl/" } } }); }
public SitecoreServicesBehaviour() { _typeProvider = new Mock <ITypeProvider>(); _nameGenerator = new Mock <IControllerNameGenerator>(); _metadataBuilder = new Mock <IMetaDataBuilder>(); var servicesConfiguration = new Mock <IServicesConfiguration>(); _sut = new SitecoreServices( _typeProvider.Object, _nameGenerator.Object, _metadataBuilder.Object, servicesConfiguration.Object); _typeProvider .SetupGet(x => x.Types) .Returns(new[] { typeof(TestController), typeof(TestService) }.AsQueryable); _nameGenerator .Setup(x => x.GetName((It.IsAny <Type>()))) .Returns("foo.bar"); servicesConfiguration.SetupGet(x => x.Configuration) .Returns(new ServicesSettingsConfiguration { Services = new ServicesSettingsConfiguration.ServiceConfiguration() { Routes = new ServicesSettingsConfiguration.ServiceConfiguration.RouteConfiguration() { RouteBase = "/baseurl/" } } }); }