Esempio n. 1
0
        public void InvokeGoHome()
        {
            var view      = new MockBrowserView();
            var history   = new MockHistory();
            var favorites = new MockFavorites();
            var config    = new MockConfig();
            var presenter = new BrowserPresenter <MockTabPresenter>(
                view,
                history,
                favorites,
                config,
                new MockFaviconCache(),
                (tab, f, c, favicons, h, tabHistory) => new MockTabPresenter(tab, f, c, favicons, h, tabHistory));

            var url  = Url.FromString("www.myfavorite.com");
            var url2 = Url.FromString("www.myfavorite2.com");

            favorites.GetOrCreate(url);
            favorites.GetOrCreate(url2);
            view.InvokeFavoritesListOpen(0);
            view.InvokeFavoritesListOpen(1);

            view.InvokeFavoritesListOpen(0);

            Assert.AreEqual(history.GetViewModel()[history.GetViewModel().Count - 1].GetUrl(), url);

            view.InvokeGoHome();

            Assert.AreEqual(history.GetViewModel()[history.GetViewModel().Count - 1].GetUrl(), config.Home);
        }
Esempio n. 2
0
        public void InvokeNewIncognitoTab()
        {
            var history   = new MockHistory();
            var favorites = new MockFavorites();
            var view      = new MockBrowserView();
            var presenter = new BrowserPresenter <MockTabPresenter>(
                view,
                history,
                favorites,
                new MockConfig(),
                new MockFaviconCache(),
                (tab, f, c, favicons, h, tabHistory) => new MockTabPresenter(tab, f, c, favicons, h, tabHistory));

            var url  = Url.FromString("www.myfavorite.com");
            var url2 = Url.FromString("www.myfavorite2.com");

            favorites.GetOrCreate(url);
            favorites.GetOrCreate(url2);
            view.InvokeFavoritesListOpen(0);
            view.InvokeFavoritesListOpen(1);

            // open and switch to an incognito tab
            view.InvokeNewIncognitoTab();

            var list = history.GetViewModel().Count;

            view.InvokeFavoritesListOpen(0);
            Assert.AreEqual(list, history.GetViewModel().Count);
        }
Esempio n. 3
0
        public void InvokeHistoryListOpen()
        {
            var config    = new MockConfig();
            var favorites = new MockFavorites();
            var view      = new MockBrowserView();
            var presenter = new BrowserPresenter <MockTabPresenter>(
                view,
                new MockHistory(),
                favorites,
                config,
                new MockFaviconCache(),
                (tab, f, c, favicons, history, tabHistory) => new MockTabPresenter(tab, f, c, favicons, history, tabHistory));

            var url  = Url.FromString("www.myfavorite.com");
            var url2 = Url.FromString("www.myfavorite2.com");

            favorites.GetOrCreate(url);
            favorites.GetOrCreate(url2);
            view.InvokeFavoritesListOpen(0);
            view.InvokeFavoritesListOpen(1);

            // 0 - mock.com
            // 1 - url
            // 2 - url2

            view.InvokeHistoryListOpen(1);

            // easiest way to check if the url has changed
            view.InvokeHomeChanged();
            Assert.AreEqual(url, config.Home);

            view.InvokeHistoryListOpen(2);

            // easiest way to check if the url has changed
            view.InvokeHomeChanged();
            Assert.AreEqual(url2, config.Home);
        }
Esempio n. 4
0
        public void InvokeHistoryListSave()
        {
            var view      = new MockBrowserView();
            var history   = new MockHistory();
            var config    = new MockConfig();
            var presenter = new BrowserPresenter <MockTabPresenter>(
                view,
                history,
                new MockFavorites(),
                config,
                new MockFaviconCache(),
                (tab, favorites, c, favicons, h, tabHistory) => new MockTabPresenter(tab, favorites, c, favicons, h, tabHistory));

            // save mock.com to favorites
            view.InvokeHistoryListSave(0);

            // open mock.com from favorites
            view.InvokeFavoritesListOpen(0);

            Assert.AreEqual(config.Home, history.GetViewModel()[history.GetViewModel().Count - 1].GetUrl());
        }
Esempio n. 5
0
        public void InvokeFavoritesListOpen()
        {
            var config    = new MockConfig();
            var favorites = new MockFavorites();
            var view      = new MockBrowserView();
            var presenter = new BrowserPresenter <MockTabPresenter>(
                view,
                new MockHistory(),
                favorites,
                config,
                new MockFaviconCache(),
                (tab, f, c, favicons, history, tabHistory) => new MockTabPresenter(tab, f, c, favicons, history, tabHistory));

            favorites.GetOrCreate(Url.FromString("www.myfavorite.com"));
            view.InvokeFavoritesListOpen(0);

            // easiest way to check if the url has changed
            var oldHome = config.Home;

            view.InvokeHomeChanged();
            Assert.AreNotEqual(oldHome, config.Home);
        }