public void Copy() { HostSetup setup = new HostSetup { ApplicationBaseDirectory = @"C:\AppBase", Configuration = { ConfigurationXml = "<xml/>" }, ConfigurationFileLocation = ConfigurationFileLocation.AppBase, ProcessorArchitecture = ProcessorArchitecture.Amd64, ShadowCopy = true, DebuggerSetup = new DebuggerSetup(), RuntimeVersion = "2.0.50727", Elevated = true, WorkingDirectory = @"C:\WorkingDir", }; setup.AddHintDirectory("Abc"); setup.AddProperty("abc", "def"); HostSetup copy = setup.Copy(); Assert.AreEqual(setup.ApplicationBaseDirectory, copy.ApplicationBaseDirectory); Assert.AreEqual(setup.Configuration.ConfigurationXml, copy.Configuration.ConfigurationXml); Assert.AreEqual(setup.ConfigurationFileLocation, copy.ConfigurationFileLocation); Assert.AreEqual(setup.ProcessorArchitecture, copy.ProcessorArchitecture); Assert.AreEqual(setup.ShadowCopy, copy.ShadowCopy); Assert.AreEqual(setup.Elevated, copy.Elevated); Assert.IsNotNull(copy.DebuggerSetup); Assert.AreEqual(setup.RuntimeVersion, copy.RuntimeVersion); Assert.AreEqual(setup.WorkingDirectory, copy.WorkingDirectory); Assert.AreEqual(setup.HintDirectories, copy.HintDirectories); Assert.AreEqual(setup.Properties, copy.Properties); }
/// <inheritdoc /> protected override object RunIsolatedTaskInHost <TIsolatedTask>(HostSetup hostSetup, StatusReporter statusReporter, object[] args) { NCoverTool tool = NCoverTool.GetInstance(version, hostSetup.ProcessorArchitecture); if (!tool.IsInstalled()) { throw new TestIsolationException(string.Format("{0} does not appear to be installed.", tool.Name)); } string ncoverArguments, ncoverCoverageFile; NCoverHost.GetNCoverProperties(hostSetup, out ncoverArguments, out ncoverCoverageFile); if (File.Exists(ncoverCoverageFile)) { File.Delete(ncoverCoverageFile); } if (batch != null) { hostSetup = hostSetup.Copy(); string tempCoverageFile = batch.Enlist(ncoverCoverageFile); NCoverHost.SetNCoverCoverageFile(hostSetup, tempCoverageFile); } return(base.RunIsolatedTaskInHost <TIsolatedTask>(hostSetup, statusReporter, args)); }
private static HostSetup ForceProcessorArchitectureAndRuntimeVersionIfRequired(HostSetup hostSetup, NCoverVersion version) { hostSetup = hostSetup.Copy(); NCoverTool tool = NCoverTool.GetInstance(version, hostSetup.ProcessorArchitecture); hostSetup.ProcessorArchitecture = tool.NegotiateProcessorArchitecture(hostSetup.ProcessorArchitecture); hostSetup.RuntimeVersion = tool.NegotiateRuntimeVersion(hostSetup.RuntimeVersion); return(hostSetup); }
/// <summary> /// Forces the processor architecture and runtime version if required. /// </summary> /// <param name="hostSetup">The host setup.</param> /// <returns>The modified host setup.</returns> private static HostSetup ForceProcessorArchitectureAndRuntimeVersionIfRequired(HostSetup hostSetup) { if (hostSetup == null) { throw new ArgumentNullException("hostSetup"); } hostSetup = hostSetup.Copy(); hostSetup.ProcessorArchitecture = PartCoverTool.NegotiateProcessorArchitecture(hostSetup.ProcessorArchitecture); hostSetup.RuntimeVersion = PartCoverTool.NegotiateRuntimeVersion(hostSetup.RuntimeVersion); return(hostSetup); }
/// <inheritdoc /> sealed protected override object RunIsolatedTaskImpl <TIsolatedTask>(HostSetup hostSetup, StatusReporter statusReporter, object[] args) { hostSetup = hostSetup.Copy(); foreach (var pair in TestIsolationOptions.Properties) { if (!hostSetup.Properties.ContainsKey(pair.Key)) { hostSetup.AddProperty(pair.Key, pair.Value); } } return(RunIsolatedTaskInHost <TIsolatedTask>(hostSetup, statusReporter, args)); }
/// <inheritdoc /> protected override object RunIsolatedTaskInHost <TIsolatedTask>(HostSetup hostSetup, StatusReporter statusReporter, object[] args) { if (!PartCoverTool.IsInstalled()) { throw new TestIsolationException(string.Format("{0} does not appear to be installed.", PartCoverTool.Name)); } string partCoverCoverageReportDir = PartCoverHost.GetPartCoverCoverageReportDir(hostSetup); if (batch != null) { hostSetup = hostSetup.Copy(); string tempCoverageFile = batch.Enlist(partCoverCoverageReportDir); PartCoverHost.SetPartCoverCoverageFile(hostSetup, tempCoverageFile); } return(base.RunIsolatedTaskInHost <TIsolatedTask>(hostSetup, statusReporter, args)); }