Ejemplo n.º 1
0
        private TestRunnerControl CreateSettingTab(Type testType)
        {
            var settingsControl = new TestRunnerControl
            {
                Dock     = DockStyle.Fill,
                Location = new System.Drawing.Point(3, 3),
                Name     = testType.Name,
                Size     = new System.Drawing.Size(916, 204),
                TabIndex = 0
            };

            var page = new TabPage
            {
                Location = new System.Drawing.Point(4, 22),
                Name     = testType.Name,
                Padding  = new Padding(3),
                Size     = new System.Drawing.Size(922, 210),
                TabIndex = 0,
                Text     = testType.Name,
                UseVisualStyleBackColor = true
            };

            page.Controls.Add(settingsControl);

            tabControl1.Controls.Add(page);
            return(settingsControl);
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            TestCase = new TestCase("TestCase", "testcase.pmlobj");
            TestCase.Tests.Add("one").Result   = new TestResult(TimeSpan.FromSeconds(1));
            TestCase.Tests.Add("two").Result   = new TestResult(TimeSpan.FromSeconds(1), new PmlError("error"));
            TestCase.Tests.Add("three").Result = new TestResult(TimeSpan.FromSeconds(1));
            TestCase.Tests.Add("four");

            RunnerMock = new Mock <AsyncTestRunner>();
            RunnerMock
            .Setup(runner => runner.RunAsync(It.IsAny <IEnumerable <Test> >()))
            .Callback((IEnumerable <Test> tests) => Tests = tests);

            RunnerControl = new TestRunnerControl(Mock.Of <TestCaseProvider>(), RunnerMock.Object, Mock.Of <SettingsProvider>());
            TestSummary   = RunnerControl.FindControl <TestSummaryView>("TestSummary");
            TestList      = RunnerControl.FindControl <TestListView>("TestList");
            TestList.TestCases.Add(TestCase);

            Model = TestList.GetModel();

            foreach (var entry in Model.Entries)
            {
                var testEntry = entry as TestListTestEntry;
                if (testEntry != null)
                {
                    testEntry.IsSelected = testEntry.Test.Name == "two" || testEntry.Test.Name == "four";
                }
            }
        }
Ejemplo n.º 3
0
        public static void TestRunnerControlInstantiation()
        {
            TestRunnerControl control = null;
            AsyncTestRunner   runner  = null;
            ObjectProxy       proxy   = null;

            try
            {
                proxy  = new StubObjectProxy();
                runner = new PmlTestRunner(proxy, new StubMethodInvoker());
                proxy  = null;
                var provider = new FileIndexTestCaseProvider();
                control = new TestRunnerControl(provider, runner, new RegistrySettingsProvider());
                runner  = null;
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.Dispose();
                }
                if (runner != null)
                {
                    runner.Dispose();
                }
                if (control != null)
                {
                    control.Dispose();
                }
            }
        }
Ejemplo n.º 4
0
        public void Dispose_DisposesTestRunner()
        {
            var runnerMock = new Mock <AsyncTestRunner>();
            var control    = new TestRunnerControl(Mock.Of <TestCaseProvider>(), runnerMock.Object, Mock.Of <SettingsProvider>());

            // Act
            control.Dispose();
            // Assert
            runnerMock.Verify(runner => runner.Dispose());
        }
Ejemplo n.º 5
0
 public void Setup()
 {
     TestCase = new TestCase("Test", "test.pmlobj");
     TestCase.Tests.Add("one");
     TestCase.Tests.Add("two");
     TestCase.Tests.Add("three");
     RunnerControl = new TestRunnerControl(Mock.Of <TestCaseProvider>(), Mock.Of <AsyncTestRunner>(), Mock.Of <SettingsProvider>());
     TestSummary   = RunnerControl.FindControl <TestSummaryView>("TestSummary");
     TestDetails   = RunnerControl.FindControl <TestDetailsView>("TestDetails");
     TestList      = RunnerControl.FindControl <TestListView>("TestList");
     TestList.TestCases.Add(TestCase);
     Model = TestList.GetModel();
 }
Ejemplo n.º 6
0
        public void Setup()
        {
            WindowMock        = new Mock <DockedWindow>();
            WindowManagerMock = new Mock <WindowManager>();
            WindowManagerMock.Setup(manager => manager.CreateDockedWindow(
                                        It.IsAny <string>(), It.IsAny <string>(),
                                        It.IsAny <Control>(), It.IsAny <DockedPosition>()
                                        )).Returns((string key, string title, Control control, DockedPosition position) => {
                WindowMock.SetupGet(window => window.Control).Returns(control);
                return(WindowMock.Object);
            });

            Control = new TestRunnerControl(Mock.Of <TestCaseProvider>(), Mock.Of <AsyncTestRunner>(), Mock.Of <SettingsProvider>());
            Command = new ShowTestRunnerCommand(WindowManagerMock.Object, Control);
        }
Ejemplo n.º 7
0
        public TestForm()
        {
            ObjectProxy       proxy   = null;
            AsyncTestRunner   runner  = null;
            TestRunnerControl control = null;

            try
            {
                Index         = new MutablePathIndex(Path.GetFullPath("..\\..\\..\\..\\pmllib-tests"));
                proxy         = new StubObjectProxy();
                runner        = new PmlTestRunner(proxy, new ControlMethodInvoker(this), new StubClock(), Index);
                proxy         = null;
                control       = new TestRunnerControl(Index, runner, new RegistrySettingsProvider());
                RunnerControl = control;
                runner        = null;
                control.Dock  = DockStyle.Fill;

                InitializeComponent();

                PathComboBox.Text          = Index.Path;
                FolderBrowser.SelectedPath = Index.Path;

                ControlPanel.Controls.Add(control);

                control = null;
            }
            finally
            {
                if (control != null)
                {
                    control.Dispose();
                }
                if (runner != null)
                {
                    runner.Dispose();
                }
                if (proxy != null)
                {
                    proxy.Dispose();
                }
            }
        }
Ejemplo n.º 8
0
        public void Setup()
        {
            TestCases = new List <TestCase>();
            var first = new TestCase("Foo", "foo.pmlobj");

            first.Tests.Add("one");
            first.Tests.Add("two");
            TestCases.Add(first);
            var second = new TestCase("Bar", "bar.pmlobj");

            second.Tests.Add("three");
            second.Tests.Add("four");
            second.Tests.Add("five");
            TestCases.Add(second);

            ProviderMock = new Mock <TestCaseProvider>();
            ProviderMock.Setup(provider => provider.GetTestCases()).Returns(TestCases);

            RunnerControl = new TestRunnerControl(ProviderMock.Object, Mock.Of <AsyncTestRunner>(), Mock.Of <SettingsProvider>());
            TestList      = RunnerControl.FindControl <TestListView>("TestList");
        }