Example #1
0
        public void UiDiscoversAnnotatedTestMethods(int testCount)
        {
            var engine = new MockedTestEngine(testCount);
            var model  = new MockedTestExplorerModel(engine);

            using (var viewModel = new MockedTestExplorer(model))
            {
                engine.ParserState.OnParseRequested(engine);
                Assert.AreEqual(testCount, viewModel.ViewModel.Tests.OfType <TestMethodViewModel>().Count());
            }
        }
Example #2
0
        public void TestGrouping_ChangesUpdateGroups(TestExplorerGrouping grouping, string expected)
        {
            var engine = new MockedTestEngine(3);
            var model  = new MockedTestExplorerModel(engine);

            using (var viewModel = new MockedTestExplorer(model))
            {
                engine.ParserState.OnParseRequested(engine);
                viewModel.ViewModel.TestGrouping = grouping;

                var actual = ((PropertyGroupDescription)viewModel.ViewModel.Tests.GroupDescriptions.First()).PropertyName;

                Assert.AreEqual(1, viewModel.ViewModel.Tests.Groups.Count);
                Assert.AreEqual(expected, actual);
            }
        }
Example #3
0
        public void UiRemovesRemovedTestMethods()
        {
            var engine = new MockedTestEngine(new List <string> {
                "TestModule1", "TestModule2"
            }, new List <int> {
                1, 1
            });
            var model = new MockedTestExplorerModel(engine);

            using (var viewModel = new MockedTestExplorer(model))
            {
                engine.ParserState.OnParseRequested(engine);
                Assert.AreEqual(2, viewModel.ViewModel.Tests.OfType <TestMethodViewModel>().Count());

                var project   = engine.Vbe.Object.VBProjects.First();
                var component = project.VBComponents.First();
                project.VBComponents.Remove(component);

                engine.ParserState.OnParseRequested(engine);
                Assert.AreEqual(1, viewModel.ViewModel.Tests.OfType <TestMethodViewModel>().Count());
            }
        }