private void InitializeContextMenu()
        {
            bool displayConfigMenu = false;
            var  test = _view.ContextNode?.Tag as TestNode;

            if (test != null && test.IsProject)
            {
                TestPackage package      = _model.GetPackageForTest(test.Id);
                string      activeConfig = _model.GetActiveConfig(package);
                var         configNames  = _model.GetConfigNames(package);

                if (configNames.Count > 0)
                {
                    _view.ActiveConfiguration.MenuItems.Clear();
                    foreach (string config in configNames)
                    {
                        var configEntry = new ToolStripMenuItem(config);
                        configEntry.Checked = config == activeConfig;
                        configEntry.Click  += (sender, e) => _model.ReloadPackage(package, ((ToolStripMenuItem)sender).Text);
                        _view.ActiveConfiguration.MenuItems.Add(configEntry);
                    }

                    displayConfigMenu = true;
                }
            }

            _view.ActiveConfiguration.Visible = displayConfigMenu;
        }
Esempio n. 2
0
        public void CheckThatTestsMapToPackages()
        {
            var package1  = _model.GetPackageForTest(_model.Tests.Id);
            var package2  = _model.GetPackageForTest(_model.Tests.Children[0].Id);
            var nopackage = _model.GetPackageForTest(_model.Tests.Children[0].Children[0].Id);

            Assert.NotNull(package1, "Package1");
            Assert.NotNull(package2, "Package2");
            Assert.Null(nopackage);

            Assert.Null(package1.Name);
            Assert.That(package1.SubPackages.Count, Is.EqualTo(1));

            Assert.That(package2.Name, Is.EqualTo(MOCK_ASSEMBLY));
            Assert.That(package2.SubPackages.Count, Is.Zero);

            Assert.That(package2, Is.SameAs(package1.SubPackages[0]));
        }