Ejemplo n.º 1
0
        public void Verify_that_registering_bad_view_does_not_work()
        {
            var filterStringService = new FilterStringService();

            Assert.AreEqual(0, filterStringService.OpenDeprecatedViewModels.Count);
            Assert.AreEqual(0, filterStringService.OpenFavoriteViewModels.Count);

            filterStringService.RegisterForService(this.badViewModel.Object);
            filterStringService.RegisterForService(this.badViewModel.Object);

            Assert.AreEqual(0, filterStringService.OpenDeprecatedViewModels.Count);
            Assert.AreEqual(0, filterStringService.OpenFavoriteViewModels.Count);
        }
Ejemplo n.º 2
0
        public void VerifyThatRegisteringDeprecatedBrowserViewModelWorks()
        {
            var deprecatable = new Mock <IDeprecatableBrowserViewModel>();
            var filterable   = deprecatable.As <IPanelFilterableDataGridViewModel>();

            filterable.SetupAllProperties();

            var panel = filterable.As <IPanelViewModel>();

            var filterStringService = new FilterStringService();

            filterStringService.RegisterForService(panel.Object);

            Assert.That(filterStringService.OpenDeprecatedViewModels.Single(), Is.EqualTo(panel.Object));
            Assert.IsTrue(filterable.Object.IsFilterEnabled);
            Assert.That(filterable.Object.FilterString, Is.EqualTo("[IsDeprecated]=False"));
        }
Ejemplo n.º 3
0
        public void VerifyThatRegisteringFavouritesBrowserViewModelWorks()
        {
            var favourites = new Mock <IFavoritesBrowserViewModel>();

            favourites.SetupAllProperties();

            var filterable = favourites.As <IPanelFilterableDataGridViewModel>();

            filterable.SetupAllProperties();
            var panel = filterable.As <IPanelViewModel>();

            ((IFavoritesBrowserViewModel)panel.Object).ShowOnlyFavorites = true;

            var filterStringService = new FilterStringService();

            filterStringService.ShowDeprecatedThings = true;

            filterStringService.RegisterForService(panel.Object);

            Assert.That(filterStringService.OpenFavoriteViewModels.Single(), Is.EqualTo(panel.Object));
            Assert.IsTrue(filterable.Object.IsFilterEnabled);
            Assert.That(filterable.Object.FilterString, Is.EqualTo("[IsFavorite]=True"));
        }