private void OnRunAllTests() { LinkedWindow.Close(); List <string> copiedAssemblies = new List <string>(); foreach (TestableDll dll in DLLs) { // Shadow copy to temp folder string tempFile = Path.GetTempFileName(); tempFile = tempFile.Replace(Path.GetExtension(tempFile), Path.GetExtension(dll.FullPath)); File.Copy(dll.FullPath, tempFile, true); //Copy the PDB to get stack trace string destPdbFile = tempFile.Replace(Path.GetExtension(tempFile), ".pdb"); string srcPdb = dll.FullPath.Replace(Path.GetExtension(dll.FullPath), ".pdb"); File.Copy(srcPdb, destPdbFile, true); copiedAssemblies.Add(tempFile); } // Copy Moq.dll and dependencies to temp folder CopyRequiredLibsToTemp(DLLs.First().FullPath); TestResult testResult = RunTestsInAssemblies(copiedAssemblies, TestFilter.Empty); // Save the result to xml file: string resultFile = Path.GetDirectoryName(DLLs.First().FullPath) + @"\TestResult.xml"; XmlResultWriter resultWriter = new XmlResultWriter(resultFile); resultWriter.SaveTestResult(testResult); // show results dialog string extraMsg = "Result file can be found at " + resultFile; TestResultViewerViewModel vm = new TestResultViewerViewModel(testResult, extraMsg); TestResultViewer viewer = new TestResultViewer(vm); //viewer.Owner = LinkedWindow; GeneralHelper.SetRevitAsWindowOwner(viewer); viewer.ShowDialog(); // cleanup foreach (string dll in copiedAssemblies) { File.Delete(dll); File.Delete(Path.ChangeExtension(dll, ".pdb")); } }
private void OnRunTest(string testDll) { string originalDllName = testDll; LinkedWindow.Close(); // Shadow copy to temp folder string tempFile = Path.GetTempFileName(); tempFile = tempFile.Replace(Path.GetExtension(tempFile), Path.GetExtension(testDll)); File.Copy(testDll, tempFile, true); //Copy the PDB to get stack trace string destPdbFile = tempFile.Replace(Path.GetExtension(tempFile), ".pdb"); string srcPdb = testDll.Replace(Path.GetExtension(testDll), ".pdb"); File.Copy(srcPdb, destPdbFile, true); testDll = tempFile; // Copy Moq.dll and dependencies to temp folder CopyRequiredLibsToTemp(tempFile); SimpleTestFilter filter = new SimpleTestFilter(DLLs.FirstOrDefault(d => d.FullPath == originalDllName).Tests); TestResult testResult = RunTestsInAssemblies(new List <string>() { testDll }, filter); // Save the result to xml file: string resultFile = Path.GetDirectoryName(testDll) + @"\TestResult.xml"; XmlResultWriter resultWriter = new XmlResultWriter(resultFile); resultWriter.SaveTestResult(testResult); // show results dialog string extraMsg = "Result file can be found at " + resultFile; TestResultViewerViewModel vm = new TestResultViewerViewModel(testResult, extraMsg); TestResultViewer viewer = new TestResultViewer(vm); //viewer.Owner = LinkedWindow; GeneralHelper.SetRevitAsWindowOwner(viewer); viewer.ShowDialog(); // cleanup File.Delete(tempFile); File.Delete(destPdbFile); }
private void OnRunTest(string testDll) { string originalDllName = testDll; LinkedWindow.Close(); // Shadow copy to temp folder string tempFile = Path.GetTempFileName(); tempFile = tempFile.Replace(Path.GetExtension(tempFile), Path.GetExtension(testDll)); File.Copy(testDll, tempFile, true); //Copy the PDB to get stack trace string destPdbFile = tempFile.Replace(Path.GetExtension(tempFile), ".pdb"); string srcPdb = testDll.Replace(Path.GetExtension(testDll), ".pdb"); File.Copy(srcPdb, destPdbFile, true); testDll = tempFile; // Copy Moq.dll and dependencies to temp folder CopyRequiredLibsToTemp(tempFile); SimpleTestFilter filter = new SimpleTestFilter(DLLs.FirstOrDefault(d => d.FullPath == originalDllName).Tests); TestResult testResult = RunTestsInAssemblies(new List<string>() { testDll }, filter); // Save the result to xml file: string resultFile = Path.GetDirectoryName(testDll) + @"\TestResult.xml"; XmlResultWriter resultWriter = new XmlResultWriter(resultFile); resultWriter.SaveTestResult(testResult); // show results dialog string extraMsg = "Result file can be found at " + resultFile; TestResultViewerViewModel vm = new TestResultViewerViewModel(testResult, extraMsg); TestResultViewer viewer = new TestResultViewer(vm); //viewer.Owner = LinkedWindow; GeneralHelper.SetRevitAsWindowOwner(viewer); viewer.ShowDialog(); // cleanup File.Delete(tempFile); File.Delete(destPdbFile); }
private void OnRunAllTests() { LinkedWindow.Close(); List<string> copiedAssemblies = new List<string>(); foreach (TestableDll dll in DLLs) { // Shadow copy to temp folder string tempFile = Path.GetTempFileName(); tempFile = tempFile.Replace(Path.GetExtension(tempFile), Path.GetExtension(dll.FullPath)); File.Copy(dll.FullPath, tempFile, true); //Copy the PDB to get stack trace string destPdbFile = tempFile.Replace(Path.GetExtension(tempFile), ".pdb"); string srcPdb = dll.FullPath.Replace(Path.GetExtension(dll.FullPath), ".pdb"); File.Copy(srcPdb, destPdbFile, true); copiedAssemblies.Add(tempFile); } // Copy Moq.dll and dependencies to temp folder CopyRequiredLibsToTemp(DLLs.First().FullPath); TestResult testResult = RunTestsInAssemblies(copiedAssemblies, TestFilter.Empty); // Save the result to xml file: string resultFile = Path.GetDirectoryName(DLLs.First().FullPath) + @"\TestResult.xml"; XmlResultWriter resultWriter = new XmlResultWriter(resultFile); resultWriter.SaveTestResult(testResult); // show results dialog string extraMsg = "Result file can be found at " + resultFile; TestResultViewerViewModel vm = new TestResultViewerViewModel(testResult, extraMsg); TestResultViewer viewer = new TestResultViewer(vm); //viewer.Owner = LinkedWindow; GeneralHelper.SetRevitAsWindowOwner(viewer); viewer.ShowDialog(); // cleanup foreach (string dll in copiedAssemblies) { File.Delete(dll); File.Delete(Path.ChangeExtension(dll, ".pdb")); } }