public static LogicalCircuit SwitchTo(CircuitProject circuitProject, string logicalCircuitName) { Assert.IsNotNull(logicalCircuitName); LogicalCircuit circuit = circuitProject.LogicalCircuitSet.FindByName(logicalCircuitName); Assert.IsNotNull(circuit, "Circuit {0} not found in the project", logicalCircuitName); if (circuitProject.ProjectSet.Project.LogicalCircuit != circuit) { circuitProject.InOmitTransaction(() => circuitProject.ProjectSet.Project.LogicalCircuit = circuit); } ProjectTester.GuaranteeGlyph(circuitProject); return(circuit); }
public static CircuitProject Load(TestContext testContext, string projectText, string initialCircuit) { // First save project text to test directory string path = Path.Combine(testContext.TestRunDirectory, string.Format("{0}.{1}.{2}.xml", testContext.FullyQualifiedTestClassName, testContext.TestName, DateTime.UtcNow.Ticks)); File.WriteAllText(path, projectText, Encoding.UTF8); // Load it from test directory CircuitProject circuitProject = CircuitProject.Create(path); File.Delete(path); ProjectTester.InitResources(); if (initialCircuit != null) { ProjectTester.SwitchTo(circuitProject, initialCircuit); } ProjectTester.GuaranteeGlyph(circuitProject); return(circuitProject); }