Esempio n. 1
0
        public void SetUp()
        {
            EFUnitOfWorkFactory.SetObjectContextProvider(() =>
            {
                var context = new SugiBpmContext();
                return(context);
            });

            var builder = new ContainerBuilder();

            builder.RegisterType <EFUnitOfWorkFactory>().As <IUnitOfWorkFactory>();
            builder.RegisterType <EFRepository <ActionDef> >().As <IRepository <ActionDef> >();
            builder.RegisterType <EFRepository <Transition> >().As <IRepository <Transition> >();
            builder.RegisterType <EFRepository <ProcessBlock> >().As <IRepository <ProcessBlock> >();
            builder.RegisterType <EFRepository <Flow> >().As <IRepository <Flow> >();
            builder.RegisterType <EFRepository <DelegationDef> >().As <IRepository <DelegationDef> >();
            builder.RegisterType <EFRepository <Actor> >().As <IRepository <Actor> >();

            builder.RegisterType <FakeDelegationHelper>().As <IDelegationHelper>();

            builder.RegisterType <OrganizationApplication>().As <IOrganizationApplication>();
            var container = builder.Build();

            Autofac.Extras.CommonServiceLocator.AutofacServiceLocator serviceLocator
                = new Autofac.Extras.CommonServiceLocator.AutofacServiceLocator(container);
            ServiceLocator.SetLocatorProvider(() => serviceLocator);
        }
Esempio n. 2
0
 public static void ConfigureContextProvider()
 {
     EFUnitOfWorkFactory.SetObjectContextProvider(() =>
     {
         var context = new SugiBpmContext();
         return(context);
     });
 }
Esempio n. 3
0
        public void Create_Returns_LinqToSqlUnitOfWork_Instance_When_DataContextProvider_Has_Been_Set()
        {
            EFUnitOfWorkFactory.SetObjectContextProvider(() => new TestModel());

            var factory     = new EFUnitOfWorkFactory();
            var uowInstance = factory.Create();

            Assert.That(uowInstance, Is.Not.Null);
            Assert.That(uowInstance, Is.TypeOf(typeof(EFUnitOfWork)));

            EFUnitOfWorkFactory.SetObjectContextProvider(null);
        }
Esempio n. 4
0
        public void SetUp()
        {
            EFUnitOfWorkFactory.SetObjectContextProvider(() =>
            {
                var context = new TestModel();
                return(context);
            });

            var locator = MockRepository.GenerateStub <IServiceLocator>();

            locator.Stub(x => x.GetInstance <IUnitOfWorkFactory>())
            .Return(new EFUnitOfWorkFactory()).Repeat.Any();
            ServiceLocator.SetLocatorProvider(() => locator);
        }
Esempio n. 5
0
        public void SetUp()
        {
            EFUnitOfWorkFactory.SetObjectContextProvider(() =>
            {
                var context = new SugiBpmContext();
                return(context);
            });

            var builder = new ContainerBuilder();

            builder.RegisterType <EFUnitOfWorkFactory>().As <IUnitOfWorkFactory>();
            builder.RegisterType <EFRepository <ActionDef> >().As <IRepository <ActionDef> >();
            builder.RegisterType <EFRepository <Transition> >().As <IRepository <Transition> >();
            builder.RegisterType <EFRepository <ProcessBlock> >().As <IRepository <ProcessBlock> >();
            builder.RegisterType <EFRepository <ProcessDefinition> >().As <IRepository <ProcessDefinition> >();
            builder.RegisterType <EFRepository <AttributeDef> >().As <IRepository <AttributeDef> >();
            builder.RegisterType <EFRepository <Field> >().As <IRepository <Field> >();

            builder.RegisterType <EFRepository <User> >().As <IRepository <User> >();
            builder.RegisterType <EFRepository <Actor> >().As <IRepository <Actor> >();
            builder.RegisterType <EFRepository <Group> >().As <IRepository <Group> >();
            builder.RegisterType <EFRepository <Membership> >().As <IRepository <Membership> >();

            builder.RegisterType <EFRepository <ProcessInstance> >().As <IRepository <ProcessInstance> >();
            builder.RegisterType <EFRepository <Flow> >().As <IRepository <Flow> >();
            builder.RegisterType <EFRepository <AttributeInstance> >().As <IRepository <AttributeInstance> >();

            builder.RegisterType <DelegationHelper>().As <IDelegationHelper>();
            builder.RegisterType <EFRepository <DelegationDef> >().As <IRepository <DelegationDef> >();

            builder.RegisterType <OrganizationApplication>().As <IOrganizationApplication>();
            builder.RegisterType <ProcessDefinitionApplication>().As <IProcessDefinitionApplication>();
            builder.RegisterType <ExecutionApplication>().As <IExecutionApplication>();

            var container = builder.Build();

            Autofac.Extras.CommonServiceLocator.AutofacServiceLocator serviceLocator
                = new Autofac.Extras.CommonServiceLocator.AutofacServiceLocator(container);
            ServiceLocator.SetLocatorProvider(() => serviceLocator);

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.Console()
                         .CreateLogger();
        }
Esempio n. 6
0
        public void SetUp()
        {
            EFUnitOfWorkFactory.SetObjectContextProvider(() =>
            {
                var context = new SugiBpmContext();
                return(context);
            });

            var builder = new ContainerBuilder();

            builder.RegisterType <EFUnitOfWorkFactory>().As <IUnitOfWorkFactory>();
            builder.RegisterType <EFRepository <Actor> >().As <IRepository <Actor> >();
            builder.RegisterType <EFRepository <Membership> >().As <IRepository <Membership> >();
            var container = builder.Build();

            Autofac.Extras.CommonServiceLocator.AutofacServiceLocator serviceLocator
                = new Autofac.Extras.CommonServiceLocator.AutofacServiceLocator(container);
            ServiceLocator.SetLocatorProvider(() => serviceLocator);
        }
Esempio n. 7
0
 public void TearDown()
 {
     EFUnitOfWorkFactory.SetObjectContextProvider(null);
 }