public void TestInitialize() { this.container = new MockUnityContainer(); this.regionManager = new MockRegionManager(); this.menuButtonView = new MockAssetBrowserMenuButtonView(); this.windowManager = new MockWindowManager(); }
public void TestInitialize() { this.unityContainer = new MockUnityContainer(); this.regionManager = new MockRegionManager(); this.menuButtonView = new MockSubClipMenuButtonView(); this.windowManager = new MockWindowManager(); }
public void ShouldAddNotificationViewToNotificationsRegion() { var toolsRegion = new MockRegion(); var regionManager = new MockRegionManager(); var container = new MockUnityContainer(); var configurationService = new MockConfigurationService(); container.Bag.Add(typeof(INotificationViewPresenter), new MockNotificationViewPresenter()); container.Bag.Add(typeof(IProjectService), new MockProjectService()); container.Bag.Add(typeof(ICacheManager), new MockCacheManager()); container.Bag.Add(typeof(IConfigurationService), configurationService); toolsRegion.Name = RegionNames.NotificationsRegion; regionManager.Regions.Add(toolsRegion); configurationService.GetParameterValueReturnFunction = p => "polling"; var module = new ServicesModule(container, regionManager); Assert.AreEqual(0, toolsRegion.AddedViews.Count); module.Initialize(); Assert.AreEqual(1, toolsRegion.AddedViews.Count); Assert.IsInstanceOfType(toolsRegion.AddedViews[0], typeof(INotificationView)); }
public void RegisterViewsServicesRegistersViewsAndServices() { try { MockUnityContainer container = new MockUnityContainer(); var contentRegistry = new MockRegionViewRegistry(); container.ResolvedContentRegistryService = contentRegistry; ServiceLocator.SetLocatorProvider( () => new MockServiceLocator( () => contentRegistry)); TestablePositionModule module = new TestablePositionModule(container, new MockRegionManager()); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(typeof(AccountPositionService), container.Types[typeof(IAccountPositionService)]); Assert.AreEqual(typeof(PositionSummaryView), container.Types[typeof(IPositionSummaryView)]); Assert.AreEqual(typeof(PositionSummaryPresentationModel), container.Types[typeof(IPositionSummaryPresentationModel)]); Assert.AreEqual(typeof(OrdersView), container.Types[typeof(IOrdersView)]); Assert.AreEqual(typeof(OrdersPresentationModel), container.Types[typeof(IOrdersPresentationModel)]); Assert.AreEqual(typeof(OrderDetailsView), container.Types[typeof(IOrderDetailsView)]); Assert.AreEqual(typeof(OrderDetailsPresentationModel), container.Types[typeof(IOrderDetailsPresentationModel)]); Assert.AreEqual(typeof(OrderCommandsView), container.Types[typeof(IOrderCommandsView)]); Assert.AreEqual(typeof(OrderCompositeView), container.Types[typeof(IOrderCompositeView)]); Assert.AreEqual(typeof(OrderCompositePresentationModel), container.Types[typeof(IOrderCompositePresentationModel)]); Assert.AreEqual(typeof(OrdersController), container.Types[typeof(IOrdersController)]); Assert.AreEqual(typeof(XmlOrdersService), container.Types[typeof(IOrdersService)]); } finally { ServiceLocator.SetLocatorProvider(null); } }
public void Setup() { this.container = new MockUnityContainer(); this.container.AddNewExtension <Interception>(); this.container.AddNewExtension <TransientPolicyBuildUpExtension>(); this.policyInjector = new PolicyInjector(new UnityServiceLocator(this.container)); }
private void TestForExpectedActions(string configName, ConfigurationActionRecord[] expectedActions) { UnityContainerElement element = GetUnitySection(configName).Containers.Default; MockUnityContainer container = new MockUnityContainer(); element.Configure(container); CollectionAssert.AreEqual(expectedActions, container.ConfigActions); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestableProjectsModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(2, container.Types.Count); Assert.AreEqual(typeof(ProjectView), container.Types[typeof(IProjectView)]); Assert.AreEqual(typeof(ProjectViewPresenter), container.Types[typeof(IProjectViewPresenter)]); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestableMediaBinModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(2, container.Types.Count); Assert.AreEqual(typeof(MediaBinView), container.Types[typeof(IMediaBinView)]); Assert.AreEqual(typeof(MediaBinViewPresentationModel), container.Types[typeof(IMediaBinViewPresentationModel)]); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestableOverlaysModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(2, container.Types.Count); Assert.AreEqual(typeof(OverlaysView), container.Types[typeof(IOverlaysView)]); Assert.AreEqual(typeof(OverlaysViewModel), container.Types[typeof(IOverlaysViewModel)]); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestablePlayerModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(3, container.Types.Count); Assert.AreEqual(typeof(AggregateMediaModel), container.Types[typeof(IAggregateMediaModel)]); Assert.AreEqual(typeof(PlayerView), container.Types[typeof(IPlayerView)]); Assert.AreEqual(typeof(PlayerViewPresenter), container.Types[typeof(IPlayerViewPresenter)]); }
public void CanInitModule() { var container = new MockUnityContainer(); MarketModule module = new MarketModule(container); 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(ITrendLinePresenter))); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestableEncoderOutputModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(3, container.Types.Count); Assert.AreEqual(typeof(OutputServiceFacade), container.Types[typeof(IOutputServiceFacade)]); Assert.AreEqual(typeof(EncoderSettingsView), container.Types[typeof(IEncoderSettingsView)]); Assert.AreEqual(typeof(EncoderSettingsPresentationModel), container.Types[typeof(IEncoderSettingsPresentationModel)]); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestableAdsModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(3, container.Types.Count); Assert.AreEqual(typeof(AdView), container.Types[typeof(IAdViewPreview)]); Assert.AreEqual(typeof(AdEditBox), container.Types[typeof(IAdEditBox)]); Assert.AreEqual(typeof(AdEditBoxPresentationModel), container.Types[typeof(IAdEditBoxPresentationModel)]); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestableTimelineModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(3, container.Types.Count); Assert.AreEqual(typeof(TimelineView), container.Types[typeof(ITimelineView)]); Assert.AreEqual(typeof(TimelinePresenter), container.Types[typeof(ITimelinePresenter)]); Assert.AreEqual(typeof(Caretaker), container.Types[typeof(ICaretaker)]); }
public void TestInitialize() { this.container = new MockUnityContainer(); this.configurationService = new MockConfigurationService(); this.eventAggregator = new MockEventAggregator(); this.thumbnailEvent = new MockThumbnailEvent(); this.eventAggregator.AddMapping <ThumbnailEvent>(this.thumbnailEvent); this.sequenceModel = new SequenceModel(this.eventAggregator); this.sequence = new Sequence(); this.container.Bag[typeof(ISequenceModel)] = this.sequenceModel; }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestableCommentsBarModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(1, container.Types.Count); Assert.AreEqual(2, container.NamedTypes[typeof(ICommentsBarPresenter)].Count); Assert.AreEqual(typeof(CommentsBarView), container.Types[typeof(ICommentsBarView)]); Assert.AreEqual(typeof(TimelineCommentsBarPresenter), container.NamedTypes[typeof(ICommentsBarPresenter)][1]); Assert.AreEqual(typeof(SubClipCommentsBarPresenter), container.NamedTypes[typeof(ICommentsBarPresenter)][0]); }
public void RegisterViewsServicesRegistersWatchListView() { var container = new MockUnityContainer(); var module = new TestableWatchModule(container, new MockRegionManager()); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(typeof(WatchListService), container.Types[typeof(IWatchListService)]); Assert.AreEqual(typeof(WatchListView), container.Types[typeof(IWatchListView)]); Assert.AreEqual(typeof(WatchListPresentationModel), container.Types[typeof(IWatchListPresentationModel)]); Assert.AreEqual(typeof(AddWatchView), container.Types[typeof(IAddWatchView)]); Assert.AreEqual(typeof(AddWatchPresenter), container.Types[typeof(IAddWatchPresenter)]); }
public void NewsModuleRegistersNewsViewAndNewsFeedService() { var container = new MockUnityContainer(); TestableNewsModule newsModule = new TestableNewsModule(container); newsModule.InvokeRegisterViewsAndServices(); Assert.AreEqual(typeof(ArticleView), container.Types[typeof(IArticleView)]); Assert.AreEqual(typeof(NewsFeedService), container.Types[typeof(INewsFeedService)]); Assert.AreEqual(typeof(NewsController), container.Types[typeof(INewsController)]); Assert.AreEqual(typeof(ArticlePresentationModel), container.Types[typeof(IArticlePresentationModel)]); Assert.AreEqual(typeof(NewsReaderPresenter), container.Types[typeof(INewsReaderPresenter)]); Assert.AreEqual(typeof(NewsReader), container.Types[typeof(INewsReaderView)]); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestableSettingsModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(4, container.Types.Count); Assert.AreEqual(typeof(SettingsView), container.Types[typeof(ISettingsView)]); Assert.AreEqual(typeof(SettingsViewPresentationModel), container.Types[typeof(ISettingsViewPresentationModel)]); Assert.AreEqual(typeof(IncreasePersistenceQuotaViewModel), container.Types[typeof(IIncreasePersistenceQuotaViewModel)]); Assert.AreEqual(typeof(IncreasePersistenceQuotaDialog), container.Types[typeof(IIncreasePersistenceQuotaDialog)]); }
public void ShouldForwardResolveAllToInnerContainer() { IEnumerable<object> list = new List<object> {new object(), new object()}; IUnityContainer container = new MockUnityContainer() { ResolveAllMethod = delegate { return list; } }; IServiceLocator containerAdapter = new UnityServiceLocatorAdapter(container); Assert.AreSame(list, containerAdapter.GetAllInstances(typeof (object))); }
public void ShouldForwardResolveToInnerContainer() { object myInstance = new object(); IUnityContainer container = new MockUnityContainer() { ResolveMethod = delegate { return myInstance; } }; IServiceLocator containerAdapter = new UnityServiceLocatorAdapter(container); Assert.AreSame(myInstance, containerAdapter.GetInstance(typeof (object))); }
public void ShouldForwardResolveToInnerContainer() { object myInstance = new object(); IUnityContainer container = new MockUnityContainer() { ResolveMethod = delegate { return(myInstance); } }; IServiceLocator containerAdapter = new UnityServiceLocatorAdapter(container); Assert.AreSame(myInstance, containerAdapter.GetInstance(typeof(object))); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestableMetadataModuleModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(8, container.Types.Count); Assert.AreEqual(typeof(ClipMetadataView), container.Types[typeof(IClipMetadataView)]); Assert.AreEqual(typeof(ClipMetadataViewPresentationModel), container.Types[typeof(IClipMetadataViewPresentationModel)]); Assert.AreEqual(typeof(SequenceMetadataViewModel), container.Types[typeof(ISequenceMetadataViewModel)]); Assert.AreEqual(typeof(SequenceMetadataView), container.Types[typeof(ISequenceMetadataView)]); Assert.AreEqual(typeof(OverlayMetadataView), container.Types[typeof(IOverlayMetadataView)]); Assert.AreEqual(typeof(OverlayMetadataViewPresentationModel), container.Types[typeof(IOverlayMetadataViewPresentationModel)]); Assert.AreEqual(typeof(TransitionsMetadataView), container.Types[typeof(ITransitionsMetadataView)]); Assert.AreEqual(typeof(TransitionsMetadataViewPresentationModel), container.Types[typeof(ITransitionsMetadataViewPresentationModel)]); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestableServicesModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(10, container.Types.Count); Assert.AreEqual(typeof(NotificationView), container.Types[typeof(INotificationView)]); Assert.AreEqual(typeof(NotificationViewPresenter), container.Types[typeof(INotificationViewPresenter)]); Assert.AreEqual(typeof(DataServiceFacade), container.Types[typeof(IDataServiceFacade)]); Assert.AreEqual(typeof(AssetsDataServiceFacade), container.Types[typeof(IAssetsDataServiceFacade)]); Assert.AreEqual(typeof(NoOpEventDataParser), container.Types[typeof(IEventDataParser <EventData>)]); Assert.AreEqual(typeof(NoOpEventOffsetParser), container.Types[typeof(IEventDataParser <EventOffset>)]); Assert.AreEqual(typeof(ProjectService), container.Types[typeof(IProjectService)]); Assert.AreEqual(typeof(TimelineBarRegistry), container.Types[typeof(ITimelineBarRegistry)]); Assert.AreEqual(typeof(WVC1CodecPrivateDataParser), container.Types[typeof(ICodecPrivateDataParser)]); }
public void ShouldRegisterViews() { var container = new MockUnityContainer(); var module = new TestablePlayerModule(container); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(9, container.Types.Count); Assert.AreEqual(typeof(PlayerView), container.Types[typeof(IPlayerView)]); Assert.AreEqual(typeof(PlayerViewPresenter), container.Types[typeof(IPlayerViewPresenter)]); Assert.AreEqual(typeof(OverlaysDisplayController), container.Types[typeof(IOverlaysDisplayController)]); Assert.AreEqual(typeof(OutputServiceFacade), container.Types[typeof(IOutputServiceFacade)]); Assert.AreEqual(typeof(ManifestMediaModel), container.Types[typeof(IManifestMediaModel)]); Assert.AreEqual(typeof(PlaybackManifestGenerator), container.Types[typeof(IPlaybackManifestGenerator)]); Assert.AreEqual(typeof(OverlaysManager), container.Types[typeof(IOverlaysManager)]); Assert.AreEqual(typeof(RubberBandingManager), container.Types[typeof(IRubberBandingManager)]); Assert.AreEqual(typeof(OverlaysDisplayController), container.Types[typeof(IOverlaysDisplayController)]); }
public void ShouldForwardResolveAllToInnerContainer() { IEnumerable <object> list = new List <object> { new object(), new object() }; IUnityContainer container = new MockUnityContainer() { ResolveAllMethod = delegate { return(list); } }; IServiceLocator containerAdapter = new UnityServiceLocatorAdapter(container); Assert.AreSame(list, containerAdapter.GetAllInstances(typeof(object))); }
public void RegisterViewsServicesRegistersViewsAndServices() { MockUnityContainer container = new MockUnityContainer(); TestablePositionModule module = new TestablePositionModule(container, new MockRegionManager()); module.InvokeRegisterViewsAndServices(); Assert.AreEqual(typeof(AccountPositionService), container.Types[typeof(IAccountPositionService)]); Assert.AreEqual(typeof(PositionSummaryView), container.Types[typeof(IPositionSummaryView)]); Assert.AreEqual(typeof(PositionSummaryPresentationModel), container.Types[typeof(IPositionSummaryPresentationModel)]); Assert.AreEqual(typeof(OrdersView), container.Types[typeof(IOrdersView)]); Assert.AreEqual(typeof(OrdersPresentationModel), container.Types[typeof(IOrdersPresentationModel)]); Assert.AreEqual(typeof(OrderDetailsView), container.Types[typeof(IOrderDetailsView)]); Assert.AreEqual(typeof(OrderDetailsPresentationModel), container.Types[typeof(IOrderDetailsPresentationModel)]); Assert.AreEqual(typeof(OrderCommandsView), container.Types[typeof(IOrderCommandsView)]); Assert.AreEqual(typeof(OrderCompositeView), container.Types[typeof(IOrderCompositeView)]); Assert.AreEqual(typeof(OrderCompositePresentationModel), container.Types[typeof(IOrderCompositePresentationModel)]); Assert.AreEqual(typeof(OrdersController), container.Types[typeof(IOrdersController)]); Assert.AreEqual(typeof(XmlOrdersService), container.Types[typeof(IOrdersService)]); }
public void ShouldRegisterViews() { var configurationService = new MockConfigurationService(); var container = new MockUnityContainer(); var module = new TestableServicesModule(container); container.Bag.Add(typeof(IConfigurationService), configurationService); configurationService.GetParameterValueReturnFunction = p => "polling"; module.InvokeRegisterViewsAndServices(); Assert.AreEqual(17, container.Types.Count); Assert.AreEqual(typeof(NotificationView), container.Types[typeof(INotificationView)]); Assert.AreEqual(typeof(NotificationViewPresenter), container.Types[typeof(INotificationViewPresenter)]); Assert.AreEqual(typeof(DataServiceFacade), container.Types[typeof(IDataServiceFacade)]); Assert.AreEqual(typeof(AssetsDataServiceFacade), container.Types[typeof(IAssetsDataServiceFacade)]); Assert.AreEqual(typeof(DefaultEventDataParser), container.Types[typeof(IEventDataParser <EventData>)]); Assert.AreEqual(typeof(DefaultEventOffsetParser), container.Types[typeof(IEventDataParser <EventOffset>)]); Assert.AreEqual(typeof(ProjectService), container.Types[typeof(IProjectService)]); Assert.AreEqual(typeof(TimelineBarRegistry), container.Types[typeof(ITimelineBarRegistry)]); Assert.AreEqual(typeof(CodecPrivateDataParser), container.Types[typeof(ICodecPrivateDataParser)]); Assert.AreEqual(typeof(CompositeSmoothStreamingCache), container.Types[typeof(ICache)]); Assert.AreEqual(typeof(FifoPurgeStrategy), container.Types[typeof(IPurgeStrategy)]); Assert.AreEqual(typeof(CacheManager), container.Types[typeof(ICacheManager)]); Assert.AreEqual(typeof(XmlKeyboardManagerService), container.Types[typeof(KeyboardManagerService)]); Assert.AreEqual(typeof(UserSettingsService), container.Types[typeof(IUserSettingsService)]); Assert.AreEqual(typeof(SequenceRegistry), container.Types[typeof(ISequenceRegistry)]); Assert.AreEqual(typeof(PollingLogEntryCollection), container.Types[typeof(ILogEntryCollection)]); Assert.AreEqual(2, container.MappingInformation.Count); Assert.AreEqual(typeof(IsolatedStorageSmoothStreamingCache), container.MappingInformation[typeof(ICache)].Item2); Assert.AreEqual("PrimaryCache", container.MappingInformation[typeof(ICache)].Item1); Assert.AreEqual(typeof(DefaultKeyboardManagerService), container.MappingInformation[typeof(KeyboardManagerService)].Item2); Assert.AreEqual("DefaultKeyboardManager", container.MappingInformation[typeof(KeyboardManagerService)].Item1); }
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); } }
protected override IUnityContainer CreateContainer() { mockContainer = new MockUnityContainer(); return mockContainer; }
protected override IUnityContainer CreateContainer() { mockContainer = new MockUnityContainer(); return(mockContainer); }
public void SetUp() { container = new MockUnityContainer(); regionManager = new MockRegionManager(); }
public void SetUp() { container = new MockUnityContainer(); regionViewRegistry = new MockRegionContentRegistry(); regionManager = new MockRegionManager(); }
public void SetUp() { this.container = new MockUnityContainer(); }