예제 #1
0
 public AutofacGlassFactoryBuilder(IConfigurationOptions options, IContainer container,
                                   Func <ILookup <Type, GlassInterfaceMetadata>, IGlassTemplateCacheService> templateCacheFactory,
                                   IGlassTypesLoader typeLoader, IImplementationFactory implFactory)
     : base(options)
 {
     if (container == null)
     {
         throw new ArgumentNullException(nameof(container));
     }
     if (templateCacheFactory == null)
     {
         throw new ArgumentNullException(nameof(templateCacheFactory));
     }
     if (typeLoader == null)
     {
         throw new ArgumentNullException(nameof(typeLoader));
     }
     if (implFactory == null)
     {
         throw new ArgumentNullException(nameof(implFactory));
     }
     _container            = container;
     _templateCacheFactory = templateCacheFactory;
     _typeLoader           = typeLoader;
     _implFactory          = implFactory;
 }
예제 #2
0
        public void TestSetup()
        {
            _mockOptions = Substitute.For <IConfigurationOptions>();
            _mockOptions.Assemblies.Returns(new[] { Assembly.GetAssembly(GetType()).FullName });
            _mockContainer = Substitute.For <IContainer>();

            _mockImplFactory = Substitute.For <IImplementationFactory>();
            _mockCache       = Substitute.For <IGlassTemplateCacheService>();
            _mockTypeLoader  = Substitute.For <IGlassTypesLoader>();

            _builder = new AutofacGlassFactoryBuilder(_mockOptions, _mockContainer, lookup => _mockCache, _mockTypeLoader, _mockImplFactory);
        }