public void ShouldRegisterViewsInRegions() { var regionViewRegistry = new MockRegionViewRegistry(); var container = new MockUnityResolver(); var clipMetadataViewModel = new MockClipMetadataViewPresentationModel(); var sequenceMetadataViewModel = new MockSequenceMetadataViewModel(); var overlayMetadataViewModel = new MockOverlayMetadataViewPresentationModel(); var transitionsMetadataViewModel = new MockTransitionsMetadataViewPresentationModel(); container.Bag.Add(typeof(IClipMetadataViewPresentationModel), clipMetadataViewModel); container.Bag.Add(typeof(ISequenceMetadataViewModel), sequenceMetadataViewModel); container.Bag.Add(typeof(IOverlayMetadataViewPresentationModel), overlayMetadataViewModel); container.Bag.Add(typeof(ITransitionsMetadataViewPresentationModel), transitionsMetadataViewModel); var module = new MetadataModule(container, regionViewRegistry); Assert.AreEqual(0, regionViewRegistry.ViewsByRegion.Count); module.Initialize(); Assert.AreEqual(3, regionViewRegistry.ViewsByRegion.Count); Assert.AreEqual(2, regionViewRegistry.ViewsByRegion[RegionNames.ClipMetadataRegion].Count); Assert.AreEqual(1, regionViewRegistry.ViewsByRegion[RegionNames.SequenceMetadataRegion].Count); Assert.AreSame(clipMetadataViewModel.View, regionViewRegistry.ViewsByRegion[RegionNames.ClipMetadataRegion][0]); Assert.AreSame(overlayMetadataViewModel.View, regionViewRegistry.ViewsByRegion[RegionNames.ClipMetadataRegion][1]); Assert.AreSame(sequenceMetadataViewModel.View, regionViewRegistry.ViewsByRegion[RegionNames.SequenceMetadataRegion][0]); }
public void ShouldAddMetadataViewToMetadataRegion() { var metadataRegion = new MockRegion(); var regionManager = new MockRegionManager(); var container = new MockUnityResolver(); container.Bag.Add(typeof(IMetadataViewPresentationModel), new MockMetadataViewPresentationModel()); regionManager.Regions.Add("MetadataRegion", metadataRegion); var module = new MetadataModule(container, regionManager); Assert.AreEqual(0, metadataRegion.AddedViews.Count); module.Initialize(); Assert.AreEqual(1, metadataRegion.AddedViews.Count); Assert.IsInstanceOfType(metadataRegion.AddedViews[0], typeof(IMetadataView)); }