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()); }
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(); } } }
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)); }
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(); } } }