public void Board_screen_cannot_be_closed()
        {
            Views.ApplicationNavigationViewModel model = new Views.ApplicationNavigationViewModel();

            model.CloseScreen(model.BoardsScreen);

            Assert.IsTrue(model.Items.Contains(model.BoardsScreen));
        }
        public MainPage()
        {
            Model = new ApplicationNavigationViewModel();
            Model.CurrentScreenChanged += Model_CurrentScreenChanged;
            Model.ScreenRemoved += Model_ScreenRemoved;
            this.InitializeComponent();

            if (Model.CurrentScreen != null)
            {
                DisplayScreen(Model.CurrentScreen);
            }
        }
        public void Openning_a_thread_sets_it_as_current()
        {
            var threadId = new Model.ThreadId(new Model.BoardId("g"), 123456);

            Views.ApplicationNavigationViewModel model = new Views.ApplicationNavigationViewModel();
            var prevItems = model.Items.ToList();
            model.OpenThread(threadId);

            var addedScreen = model.Items.Except(prevItems).Single();

            Assert.AreSame(addedScreen, model.CurrentScreen);
        }
        public void Openning_a_thread_again_sets_it_as_current()
        {
            var threadId = new Model.ThreadId(new Model.BoardId("g"), 123456);
            Views.ApplicationNavigationViewModel model = new Views.ApplicationNavigationViewModel();

            model.OpenThread(threadId);
            var boardScreen = model.CurrentScreen;
            model.ItemClicked(model.BoardsScreen);

            model.OpenThread(threadId);

            Assert.AreSame(boardScreen, model.CurrentScreen);
        }
        public void Openning_a_thread_again_doesnt_add_it_again()
        {
            var threadId = new Model.ThreadId(new Model.BoardId("g"), 123456);
            Views.ApplicationNavigationViewModel model = new Views.ApplicationNavigationViewModel();
            model.OpenThread(threadId);

            var prevItems = model.Items.ToList();
            model.OpenThread(threadId);
            var addedScreens = model.Items.Except(prevItems).ToList();

            Assert.AreEqual(0, addedScreens.Count, "Screen was added when it shouldn't be!");
        }
        public void Openning_a_thread_adds_it_to_items()
        {
            var threadId = new Model.ThreadId(new Model.BoardId("g"), 123456);

            Views.ApplicationNavigationViewModel model = new Views.ApplicationNavigationViewModel();
            var prevItems = model.Items.ToList();

            model.OpenThread(threadId);

            var newItems = model.Items.Except(prevItems).ToList();

            Assert.AreEqual(1, newItems.Count, "Not exactly one screen was added");

            var addedScreen = newItems.First();
            Assert.IsInstanceOfType(addedScreen, typeof(ThreadViewModel), "Added screen didn't seem to be correct type!");
            Assert.AreEqual(threadId, (addedScreen as ThreadViewModel).ThreadId, "Added screen didn't seem to have correct id!");
        }
        public void Navigaion_contains_boards_screen()
        {
            Views.ApplicationNavigationViewModel model = new Views.ApplicationNavigationViewModel();

            Assert.IsTrue(model.Items.Any(x => x.Title == "Boards"));
            Assert.AreSame(model.BoardsScreen, model.CurrentScreen);
        }