public static void Start() { ApplicationStartup.Initialize(); var container = IoC.Container; using (container.OptimizeDependencyResolution()) { var register = new SerializerRegister(); container.Register <IPresentationUserSettings, IUserSettings, ICoreUserSettings, BatchUserSettings>(LifeStyle.Transient); container.AddRegister(x => { x.FromType <CoreRegister>(); x.FromType <OSPSuite.Core.CoreRegister>(); x.FromType <BatchRegister>(); x.FromType <InfrastructureRegister>(); x.FromType <SBMLImportRegister>(); x.FromInstance(new PresentationRegister(false)); x.FromInstance(register); }); register.PerformMappingForSerializerIn(container); container.Register <IJournalDiagramManagerFactory, BatchJournalDiagramManagerFactory>(); container.Register <IDiagramModelToXmlMapper, BatchDiagramModelToXmlMapper>(LifeStyle.Singleton); container.Register <IDiagramModel, BatchDiagramModel>(LifeStyle.Singleton); } setupDimensions(container); setupCalculationMethods(container); }
private static void registerSerializationDependencies(IContainer container) { //create serializer repository for xml persisentence and register all available serializer var register = new SerializerRegister(); container.AddRegister(x => x.FromInstance(register)); register.PerformMappingForSerializerIn(container); }
public override void GlobalContext() { base.GlobalContext(); var windsorContainer = new CastleWindsorContainer(); IContainer container = windsorContainer; windsorContainer.WindsorContainer.AddFacility <TypedFactoryFacility>(); IoC.InitializeWith(container); IoC.RegisterImplementationOf(container); //need to register these services for which the default implementation is in the UI using (container.OptimizeDependencyResolution()) { container.RegisterImplementationOf(new SynchronizationContext()); container.Register <IExceptionManager, ExceptionManagerForSpecs>(LifeStyle.Singleton); container.RegisterImplementationOf(A.Fake <IUserSettings>()); container.RegisterImplementationOf(A.Fake <IDialogCreator>()); container.RegisterImplementationOf(A.Fake <IProgressUpdater>()); container.RegisterImplementationOf(A.Fake <IMoBiHistoryManager>()); container.RegisterImplementationOf(A.Fake <IXmlContentSelector>()); container.RegisterImplementationOf(A.Fake <IDiagramModel>()); container.RegisterImplementationOf(A.Fake <IDiagramTask>()); container.RegisterImplementationOf(A.Fake <IMRUProvider>()); container.RegisterImplementationOf(A.Fake <IFileLocker>()); container.RegisterImplementationOf(A.Fake <IDisplayUnitRetriever>()); container.RegisterImplementationOf(A.Fake <IJournalDiagramManagerFactory>()); container.RegisterImplementationOf(A.Fake <ISimulationDiagramManager>()); container.RegisterImplementationOf(A.Fake <ISpatialStructureDiagramManager>()); container.RegisterImplementationOf(A.Fake <IMoBiReactionDiagramManager>()); container.RegisterImplementationOf(A.Fake <ISimulationDiagramView>()); container.RegisterImplementationOf(A.Fake <IContainerBaseLayouter>()); container.RegisterImplementationOf(A.Fake <ILayerLayouter>()); container.Register <IDiagramModelToXmlMapper, BatchDiagramModelToXmlMapper>(); container.Register <IMoBiConfiguration, MoBiConfiguration>(LifeStyle.Singleton); container.Register <IEventPublisher, EventPublisher>(LifeStyle.Singleton); IHeavyWorkManager heavyWorkManager = new HeavyWorkManagerForSpecs(); container.RegisterImplementationOf(heavyWorkManager); container.RegisterImplementationOf(A.Fake <IProgressManager>()); var config = container.Resolve <IMoBiConfiguration>(); container.RegisterImplementationOf((IApplicationConfiguration)config); var register = new SerializerRegister(); container.AddRegister(x => { x.FromType <CoreRegister>(); x.FromType <Core.CoreRegister>(); x.FromInstance(new PresentationRegister(false)); x.FromType <SBMLImportRegister>(); x.FromType <InfrastructureRegister>(); x.FromInstance(register); }); register.PerformMappingForSerializerIn(container); container.RegisterImplementationOf(A.Fake <IMoBiMainViewPresenter>()); setupDimensions(container); setupCalculationMethods(container); var context = container.Resolve <IMoBiContext>(); container.RegisterImplementationOf <IWorkspace>(context); } //Required for usage with nunit 3 Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory; }