Esempio n. 1
0
        public async Task DeleteTabCommand_ShouldDeleteTabs_AndPreserveInitialDefaultTab()
        {
            var tab1 = await TabGenerator.CreateTab(order : 0);

            var tab2 = await TabGenerator.CreateTab(order : 1);

            _viewModel.LoadTabsCommand.Execute();

            // 1. Deleting the first item
            var tabItem1 = _viewModel.Tabs.First(t => t.Id == tab1.Id);
            var tabItem2 = _viewModel.Tabs.First(t => t.Id == tab2.Id);

            _viewModel.DeleteTabCommand.Execute(tabItem1);

            Assert.DoesNotContain(_viewModel.Tabs, t => t.Id == tab1.Id);

            // 2. Deleting the second item
            _viewModel.DeleteTabCommand.Execute(tabItem2);

            Assert.DoesNotContain(_viewModel.Tabs, t => t.Id == tab2.Id);

            // 3. Initial default tab is preserved
            Assert.Single(_viewModel.Tabs);
            Assert.Equal(DefaultValues.DefaultTabName, _viewModel.Tabs[0].Header);

            // 4. Making sure the tabs were deleted after reloading
            _viewModel.LoadTabsCommand.Execute();

            Assert.Single(_viewModel.Tabs);
        }
Esempio n. 2
0
        public async Task LoadTabsCommand_ShouldLoadAllTabsWithInitialDefaultTab()
        {
            _viewModel.LoadTabsCommand.Execute();
            Assert.Single(_viewModel.Tabs);

            var tab1 = await TabGenerator.CreateTab(order : 1);

            var tab2 = await TabGenerator.CreateTab(order : 2);

            _viewModel.LoadTabsCommand.Execute();

            AssertItemInCollection(_viewModel.Tabs, tab1);
            AssertItemInCollection(_viewModel.Tabs, tab2);
        }