Example #1
0
        public void Dispose_ShouldOnlyDisposeTheProxyOnce()
        {
            var proxy  = new Mock <ObjectProxy>();
            var runner = new PmlTestRunner(proxy.Object, Mock.Of <MethodInvoker>());

            runner.Dispose();
            runner.Dispose();
            proxy.Verify(p => p.Dispose(), Times.Once());
        }
Example #2
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();
                }
            }
        }
Example #3
0
        public void Run_ShouldFailAfterBeingDisposed()
        {
            var runner = new PmlTestRunner(Mock.Of <ObjectProxy>(), Mock.Of <MethodInvoker>(), Mock.Of <Clock>());

            runner.Dispose();
            Assert.Throws <ObjectDisposedException>(() => runner.Run(TestCase));
            Assert.Throws <ObjectDisposedException>(() => runner.Run(Test));
        }
Example #4
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();
                }
            }
        }