Ejemplo n.º 1
0
        public CartTests()
        {
            var builder = AutoFacLoader.Builder();

            builder.Register(r => new CartRepositoryFactoryTestClass(r.Resolve <IDataRepositoryFactory>()));
            ObjectBase.Container = builder.Build();
            //_albums = new List<Album> {
            //  new Album() { AlbumId = 1, Title = "Title1", Artist = "Artist1", Genre  ="Genre1", AlbumNumber = "AlNm1", Price = 1, StockAmount = 1 },
            //  new Album() { AlbumId = 2, Title = "Title2", Artist = "Artist2", Genre  ="Genre2", AlbumNumber = "AlNm2", Price = 2, StockAmount = 2 } };
        }
Ejemplo n.º 2
0
        public TrackTests()
        {
            var builder = AutoFacLoader.Builder();

            builder.Register(r => new TrackRepositoryTestClass(r.Resolve <ITrackRepository>()));
            ObjectBase.Container = builder.Build(); //  AutoFacLoader.Init()
            _tracks = new List <Track>
            {
                new Track()
                {
                    TrackId = 1, Name = "Name1"
                },
                new Track()
                {
                    TrackId = 2, Name = "Name2"
                }
            };
        }
Ejemplo n.º 3
0
        public static void Configure()
        {
            // MVC setup documentation here:
            // http://autofac.readthedocs.io/en/latest/integration/mvc.html
            // WCF setup documentation here:
            // http://autofac.readthedocs.io/en/latest/integration/wcf.html
            //

            var builder = AutoFacLoader.Builder();

            builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly());

            builder.RegisterType <SecurityAdapter>().As <Core.ISecurityAdapter>()
            .AsImplementedInterfaces().InstancePerDependency();
            var container = builder.Build();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
            GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container);
        }