protected Environment getEnvironment(XdmNode testCase, XPathCompiler xpc) { string testCaseName = testCase.GetAttributeValue(new QName("name")); XdmNode environmentNode = (XdmNode)xpc.EvaluateSingle("environment", testCase); Environment env; if (environmentNode == null) { env = localEnvironments["default"]; } else { string envName = environmentNode.GetAttributeValue(new QName("ref")); if (envName == null || envName.Equals("")) { env = Environment.processEnvironment(this, xpc, environmentNode, null, localEnvironments["default"]); bool baseUriCheck = ((XdmAtomicValue)xpc.EvaluateSingle("static-base-uri/@uri='#UNDEFINED'", environmentNode)).GetBooleanValue(); if (baseUriCheck) { //writeTestcaseElement(testCaseName, "notRun", "static-base-uri not supported", null); return(null); } } else { try { env = localEnvironments[envName]; }catch (Exception) { env = null; } if (env == null) { try { env = globalEnvironments[envName]; } catch (Exception e) { } } if (env == null) { foreach (XdmNode e in testCase.Parent.Select(Steps.Descendant("environment").Where(Predicates.AttributeEq("name", envName)))) { Environment.processEnvironment(this, xpc, e, localEnvironments, localEnvironments["default"]); } try { env = localEnvironments[envName]; } catch (Exception e) {} } if (env == null) { System.Console.WriteLine("*** Unknown environment " + envName); //println("*** Unknown environment " + envName); //writeTestcaseElement(testCaseName, "fail", "Environment " + envName + " not found", null); failures++; return(null); } } } return(env); }