public void LoadProject(string fileName, bool silent) { if (!File.Exists(fileName)) { if (!silent) { MessageBox.Show("Could not find file"); } return; } try { this.MessageOnStatusBar("Loading {0}", fileName); MbUnitProject project = MbUnitProject.Load(fileName); // removing assemblies this.RemoveAssemblies(); // adding assemblies foreach (string testFilePath in project.Assemblies) { this.AddAssembly(testFilePath); } // setting state this.state.Load(project.TreeState); } catch (Exception ex) { if (ex is System.Threading.ThreadAbortException) { return; } MessageBox.Show(ex.ToString()); } }
public void SaveProject(string fileName) { MbUnitProject project = new MbUnitProject(); foreach (TestDomain domain in this.TestDomains) { project.Assemblies.Add(domain.TestFilePath); } this.state.Save(); project.TreeState = this.state.GetTreeViewState(); project.Save(fileName); }
public void SaveAndLoadTest() { // Save test project proj = new MbUnitProject(); proj.Assemblies.Add("string1"); proj.Assemblies.Add("string2"); proj.Assemblies.Add("string3"); proj.Save(filename); // Re-load project proj = MbUnitProject.Load(filename); Assert.AreEqual(3, proj.Assemblies.Count); CollectionAssert.Contains(proj.Assemblies, "string1"); CollectionAssert.Contains(proj.Assemblies, "string2"); CollectionAssert.Contains(proj.Assemblies, "string3"); }
public void SaveNullTest() { proj = new MbUnitProject(); proj.Save(null); }
public void LoadNullTest() { proj = MbUnitProject.Load(null); }
public static TestDomainDependencyGraph BuildGraph( string[] testAssemblies, string[] assemblyPaths, IFixtureFilter fixtureFilter, IRunPipeFilter runPipeFilter, bool verbose ) { // MLS 12/21/05 - adding verbose parameter to fix MBUNIT-28 (verbose command line option not working). // IDEA: A more flexible solution might be to pass in a collection of IRunPipeListeners. if (testAssemblies == null) { throw new ArgumentNullException("testAssemblies"); } if (testAssemblies.Length == 0) { throw new ArgumentException("No assembly to test"); } if (fixtureFilter == null) { throw new ArgumentNullException("fixtureFilter"); } if (runPipeFilter == null) { throw new ArgumentNullException("runPipeFilter"); } Hashtable loadedAssemblies = new Hashtable(); TestDomainDependencyGraph graph = null; try { graph = new TestDomainDependencyGraph(); graph.verbose = verbose; if (assemblyPaths != null) { graph.AssemblyPaths.AddRange(assemblyPaths); } foreach (string testAssembly in testAssemblies) { if (testAssembly.EndsWith(".mbunit")) { MbUnitProject project = MbUnitProject.Load(testAssembly); foreach (string assembly in project.Assemblies) { if (loadedAssemblies.Contains(assembly)) { continue; } TestDomain domain = new TestDomain(assembly); domain.Filter = fixtureFilter; domain.RunPipeFilter = runPipeFilter; graph.AddDomain(domain); loadedAssemblies.Add(assembly, null); } } else { if (loadedAssemblies.Contains(testAssembly)) { continue; } TestDomain domain = new TestDomain(testAssembly); domain.Filter = fixtureFilter; domain.RunPipeFilter = runPipeFilter; graph.AddDomain(domain); loadedAssemblies.Add(testAssembly, null); } } graph.CreateDependencies(); return(graph); } catch (System.Runtime.Remoting.RemotingException remote) { throw remote; } catch (Exception ex) { if (graph != null) { graph.Dispose(); graph = null; } throw new ApplicationException("Failed loading assemblies", ex); } }