Пример #1
0
        protected override void RegisterTypes()
        {
            Container.Register <IServiceMock, ServiceMock>();
            Container.RegisterTypeForNavigation <ViewMock>("view");
            Container.RegisterTypeForNavigation <ViewAMock, ViewModelAMock>();
            Container.Register <AutowireViewModel>();
            Container.Register <ViewModelAMock>();
            Container.Register <ViewModelBMock>(serviceKey: ViewModelBMock.Key);
            Container.Register <ConstructorArgumentViewModel>();
            Container.RegisterTypeForNavigation <AutowireView, AutowireViewModel>();
            Container.RegisterTypeForNavigation <ConstructorArgumentView, ConstructorArgumentViewModel>();
            Container.Register <ModuleMock>(Reuse.Singleton);

            FormsDependencyService.Register <IDependencyServiceMock>(new DependencyServiceMock());
        }
Пример #2
0
        protected override void RegisterTypes()
        {
            Container.RegisterType <IServiceMock, ServiceMock>();
            Container.RegisterTypeForNavigation <ViewMock>("view");
            Container.RegisterTypeForNavigation <ViewAMock, ViewModelAMock>();
            Container.RegisterType <AutowireViewModel>();
            Container.RegisterType <ViewModelAMock>();
            Container.RegisterType <ViewModelBMock>(ViewModelBMock.Key);
            Container.RegisterType <ConstructorArgumentViewModel>();
            Container.RegisterTypeForNavigation <AutowireView, AutowireViewModel>();
            Container.RegisterTypeForNavigation <ConstructorArgumentView, ConstructorArgumentViewModel>();
            Container.RegisterType <ModuleMock>(new ContainerControlledLifetimeManager());

            FormsDependencyService.Register <IDependencyServiceMock>(new DependencyServiceMock());
        }
Пример #3
0
        protected override void RegisterTypes()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <ServiceMock>().As <IServiceMock>();
            builder.RegisterType <AutowireViewModel>();
            builder.RegisterType <ViewModelAMock>();
            builder.Register(ctx => new ViewModelBMock()).Named <ViewModelBMock>(ViewModelBMock.Key);
            builder.RegisterType <ConstructorArgumentViewModel>();
            builder.RegisterType <ModuleMock>().SingleInstance();

            builder.Update(Container);

            Container.RegisterTypeForNavigation <ViewMock>("view");
            Container.RegisterTypeForNavigation <ViewAMock, ViewModelAMock>();
            Container.RegisterTypeForNavigation <AutowireView, AutowireViewModel>();
            Container.RegisterTypeForNavigation <ConstructorArgumentView, ConstructorArgumentViewModel>();

            FormsDependencyService.Register <IDependencyServiceMock>(new DependencyServiceMock());
        }