public void BuildCommandSwitchesToBuildMapView() { var objectSource = new Mock<IContainerInfo>(); var stringService = new ComponentRegistration(); objectSource.Setup(o => o.GetServices()).Returns( new List<ComponentRegistration> { stringService, } ); var visualizerViewModel = new VisualizerViewModel(objectSource.Object); visualizerViewModel.Components.MoveCurrentToFirst(); visualizerViewModel.BuildCommand.Execute(stringService); Assert.AreEqual(View.BuildMap, visualizerViewModel.CurrentView); }
public void FiltersRegistrationsBasedOnFilterText() { var objectSource = new Mock<IContainerInfo>(); var stringService = new ComponentRegistration { Type = typeof(string), Services = new List<TypedService> { new TypedService{Type = typeof(string) }} }; var objectService = new ComponentRegistration { Type = typeof(object), Services = new List<TypedService> { new TypedService{Type = typeof(object) } }}; objectSource.Setup(o => o.GetServices()).Returns( new List<ComponentRegistration> { stringService, objectService, } ); var visualizerViewModel = new VisualizerViewModel(objectSource.Object); visualizerViewModel.FilterText = "s"; Assert.IsTrue(visualizerViewModel.Components.Filter(stringService)); Assert.IsFalse(visualizerViewModel.Components.Filter(objectService)); visualizerViewModel.FilterText = "o"; Assert.IsFalse(visualizerViewModel.Components.Filter(stringService)); Assert.IsTrue(visualizerViewModel.Components.Filter(objectService)); }