Example #1
0
    private void Application_Startup(object sender, StartupEventArgs e)
    {
        container = RegisterIoc();
        var mainwindow = container.Resolve <MainWindow>();

        mainwindow.Show();
    }
Example #2
0
        public void CoreModule()
        {
            var container = new DryIoc.Container();

            var module = new CoreModule(container);

            module.Initialize();

            container.Dispose();
        }
Example #3
0
        public void SignalRModule()
        {
            var container = new DryIoc.Container();
            var mock      = new Mock <Prism.Regions.IRegionManager>();

            var module = new SignalRModule(container, mock.Object);

            module.Initialize();

            container.Dispose();
        }
Example #4
0
    private DryIoc.Container RegisterIoc()
    {
        var container = new DryIoc.Container();

        container.Register <MainWindow>();
        container.Register <Window2>();
        container.Register <IManager1, Manager1>(Reuse.Singleton);
        container.Register <IManager2, Manager2>(Reuse.Singleton);
        container.Register <IManager3, Manager3>(Reuse.Singleton);
        return(container);
    }
Example #5
0
        public void OverlayModule()
        {
            var container = new DryIoc.Container();
            var mock      = new Mock <Prism.Regions.IRegionManager>();

            mock.Setup(m => m.RegisterViewWithRegion(It.IsNotNull <string>(), It.IsNotNull <Type>()));

            var module = new OverlayModule(container, mock.Object);

            module.Initialize();

            container.Dispose();
        }
        public UpdateBookFavoriteTest()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase("UpdateBookFavoriteTest" + Guid.NewGuid()).EnableSensitiveDataLogging().Options;

            _dbContext = new ApplicationDbContext(options);

            var container = new DryIoc.Container()
                            .WithDependencyInjectionAdapter(new ServiceCollection())
                            .ConfigureServiceProvider <CompositionRoot>();

            var httpContextAccessor = new HttpContextAccessor
            {
                HttpContext = new DefaultHttpContext
                {
                    RequestServices = container,
                }
            };

            _httpContextAccessor = httpContextAccessor;
        }
Example #7
0
        public GetPermissionByUserIdTest()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase("GetPermissionByUserIdTest" + Guid.NewGuid()).Options;

            _dbContext = new ApplicationDbContext(options);

            var container = new DryIoc.Container()
                            .WithDependencyInjectionAdapter(new ServiceCollection())
                            .ConfigureServiceProvider <CompositionRoot>();

            var httpContextAccessor = new HttpContextAccessor
            {
                HttpContext = new DefaultHttpContext
                {
                    RequestServices = container,
                }
            };

            _httpContextAccessor = httpContextAccessor;
        }
        public GetUserNotificationTest()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase("GetUserNotificationTest" + Guid.NewGuid()).Options;

            _dbContext = new ApplicationDbContext(options);

            var container = new DryIoc.Container()
                            .WithDependencyInjectionAdapter(new ServiceCollection())
                            .ConfigureServiceProvider <CompositionRoot>();

            var httpContextAccessor = new HttpContextAccessor
            {
                HttpContext = new DefaultHttpContext
                {
                    RequestServices = container,
                    User            = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim("userId", "1") }))
                }
            };

            _httpContextAccessor = httpContextAccessor;
        }
Example #9
0
 public DeckRunner([NotNull] Container container, [NotNull] ILogger logger, [NotNull] PathResolver pathResolver)
 {
     _Container = container ?? throw new ArgumentNullException(nameof(container));
     _Device    = DeckDevice.GetInstance() ?? throw new InvalidOperationException("No Stream Deck device found");
 }