Esempio n. 1
0
        public void InvokeBackTest()
        {
            var tabHistory = new MockTabHistory();

            var view      = new MockTabView();
            var presenter = new TabPresenter(
                view,
                new MockFavorites(),
                new MockConfig(),
                new MockFaviconCache(),
                new MockHistory(),
                tabHistory);

            var url1 = Url.FromString("www.first.com");
            var url2 = Url.FromString("www.second.com");

            presenter.Push(url1);
            presenter.Push(url2);

            Assert.AreEqual(url2, tabHistory.Current().Url);

            view.InvokeBack();

            Assert.AreEqual(url1, tabHistory.Current().Url);
        }
Esempio n. 2
0
        public void PushTest()
        {
            var tabHistory = new MockTabHistory();

            var presenter = new TabPresenter(
                new MockTabView(),
                new MockFavorites(),
                new MockConfig(),
                new MockFaviconCache(),
                new MockHistory(),
                tabHistory);

            var url = Url.FromString("www.test.com");

            presenter.Push(url);
            Assert.AreEqual(url, tabHistory.Current().Url);
        }
Esempio n. 3
0
        public void InvokeReloadTest()
        {
            var view      = new MockTabView();
            var presenter = new TabPresenter(
                view,
                new MockFavorites(),
                new MockConfig(),
                new MockFaviconCache(),
                new MockHistory(),
                new MockTabHistory());

            presenter.Push(Url.FromString("www.test.com"));

            int pageloads = view.PageLoads;

            view.InvokeReload();
            Assert.AreEqual(++pageloads, view.PageLoads);
        }
Esempio n. 4
0
        public void InvokeAddFavoriteTest()
        {
            var favorites = new MockFavorites();

            var view      = new MockTabView();
            var presenter = new TabPresenter(
                view,
                favorites,
                new MockConfig(),
                new MockFaviconCache(),
                new MockHistory(),
                new MockTabHistory());

            var url = Url.FromString("www.test.com");

            presenter.Push(url);
            view.InvokeAddFavorite();
            Assert.IsNotNull(favorites.GetViewModel().Single(model => model.Url == url.ToString()));
        }