Example #1
0
        public void CanInitModule()
        {
            try
            {
                MockUnityContainer container = new MockUnityContainer();
                var contentRegistry          = new MockRegionViewRegistry();
                container.ResolveTypes[typeof(IRegionViewRegistry)] = contentRegistry;
                ServiceLocator.SetLocatorProvider(
                    () => new MockServiceLocator(
                        () => contentRegistry));
                MarketModule module = new MarketModule(container, new MockRegionManager());

                module.Initialize();

                Assert.IsTrue(container.Types.ContainsKey(typeof(IMarketHistoryService)));
                Assert.IsTrue(container.Types.ContainsKey(typeof(IMarketFeedService)));
                Assert.IsTrue(container.Types.ContainsKey(typeof(ITrendLineView)));
                Assert.IsTrue(container.Types.ContainsKey(typeof(ITrendLinePresentationModel)));
            }
            finally
            {
                ServiceLocator.SetLocatorProvider(() => null);
            }
        }
Example #2
0
        public void CanInitModule()
        {
            try
            {
                MockUnityContainer container = new MockUnityContainer();
                var contentRegistry = new MockRegionViewRegistry();
                container.ResolveTypes[typeof(IRegionViewRegistry)] = contentRegistry;
                ServiceLocator.SetLocatorProvider(
                    () => new MockServiceLocator(
                            () => contentRegistry));
                MarketModule module = new MarketModule(container, new MockRegionManager());

                module.Initialize();

                Assert.IsTrue(container.Types.ContainsKey(typeof(IMarketHistoryService)));
                Assert.IsTrue(container.Types.ContainsKey(typeof(IMarketFeedService)));
                Assert.IsTrue(container.Types.ContainsKey(typeof(ITrendLineView)));
                Assert.IsTrue(container.Types.ContainsKey(typeof(ITrendLinePresentationModel)));
            }
            finally 
            {
                ServiceLocator.SetLocatorProvider(() => null);
            }
        }