Exemplo n.º 1
0
        public SmidgeHelperTests()
        {
            //  var config = Mock.Of<ISmidgeConfig>();
            _httpContext         = new Mock <HttpContext>();
            _httpContextAccessor = new Mock <IHttpContextAccessor>();
            _httpContextAccessor.Setup(x => x.HttpContext).Returns(_httpContext.Object);

            _dynamicallyRegisteredWebFiles = new DynamicallyRegisteredWebFiles();
            _fileSystemHelper = new FileSystemHelper(_hostingEnvironment, _config, _fileProvider, _hasher);

            _smidgeOptions = new Mock <IOptions <SmidgeOptions> >();
            _smidgeOptions.Setup(opt => opt.Value).Returns(new SmidgeOptions
            {
                DefaultBundleOptions = new BundleEnvironmentOptions()
            });

            _requestHelper     = Mock.Of <IRequestHelper>();
            _processorFactory  = new PreProcessPipelineFactory(new Lazy <IEnumerable <IPreProcessor> >(() => _preProcessors));
            _bundleManager     = new BundleManager(_smidgeOptions.Object, Mock.Of <ILogger <BundleManager> >());
            _preProcessManager = new PreProcessManager(
                _fileSystemHelper,
                new CacheBusterResolver(Enumerable.Empty <ICacheBuster>()),
                _bundleManager, Mock.Of <ILogger <PreProcessManager> >());
            _fileSetGenerator = new BundleFileSetGenerator(_fileSystemHelper, _requestHelper,
                                                           new FileProcessingConventions(_smidgeOptions.Object, new List <IFileProcessingConvention>()));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="fileSystemHelper"></param>
 /// <param name="bundleManager"></param>
 /// <param name="fileSetGenerator"></param>
 /// <param name="processorFactory"></param>
 /// <param name="preProcessManager"></param>
 /// <param name="logger"></param>
 public SmidgeController(
     FileSystemHelper fileSystemHelper,
     IBundleManager bundleManager,
     IBundleFileSetGenerator fileSetGenerator,
     PreProcessPipelineFactory processorFactory,
     PreProcessManager preProcessManager,
     ILogger <SmidgeController> logger)
 {
     if (fileSystemHelper == null)
     {
         throw new ArgumentNullException(nameof(fileSystemHelper));
     }
     if (bundleManager == null)
     {
         throw new ArgumentNullException(nameof(bundleManager));
     }
     if (fileSetGenerator == null)
     {
         throw new ArgumentNullException(nameof(fileSetGenerator));
     }
     if (processorFactory == null)
     {
         throw new ArgumentNullException(nameof(processorFactory));
     }
     if (preProcessManager == null)
     {
         throw new ArgumentNullException(nameof(preProcessManager));
     }
     _fileSystemHelper  = fileSystemHelper;
     _bundleManager     = bundleManager;
     _fileSetGenerator  = fileSetGenerator;
     _processorFactory  = processorFactory;
     _preProcessManager = preProcessManager;
     _logger            = logger;
 }