Ejemplo n.º 1
0
        public FieldDefinition(GeneratorBase generator, XmlNode field)
        {
            Type = field.GetAttribute("type");
            Name = field.GetAttribute("name");
            Description = field.InnerText;
            ArrayLength = 0;

            string alternativeName;
            if (generator.ReservedWords.TryGetValue(Name, out alternativeName))
                Name = alternativeName;

            Match match = _arrayRegEx.Match(Type);
            if (match.Success)
            {
                // It's an array, modify Type and remember length of array
                ArrayLength = int.Parse(match.Groups["length"].Value);
                Type = Type.Replace(match.Value, "");
            }

            Tuple<string, int> csharpType;
            if (generator.TypeMap.TryGetValue(Type, out csharpType))
            {
                Type = csharpType.Item1;
                TypeSize = csharpType.Item2;
            }

            if (ArrayLength > 0)
            {
                Type = generator.GetArrayDefinitionForType(Type, ArrayLength, TypeSize);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called when a test has finished
        /// </summary>
        /// <param name="result">The result of the test</param>
        public void TestFinished(XmlNode result)
        {
            string name = result.GetAttribute("fullname");
            double duration = result.GetAttribute("duration", 0.0);
            string testId = result.GetAttribute("id");

            switch (result.GetAttribute("result"))
            {
                case "Passed":
                    TC_TestFinished(name, duration, testId);
                    break;
                case "Inconclusive":
                    TC_TestIgnored(name, "Inconclusive", testId);
                    break;
                case "Skipped":
                    XmlNode reason = result.SelectSingleNode("reason/message");
                    TC_TestIgnored(name, reason == null ? "" : reason.InnerText, testId);
                    break;
                case "Failed":
                    XmlNode message = result.SelectSingleNode("failure/message");
                    XmlNode stackTrace = result.SelectSingleNode("failure/stack-trace");
                    TC_TestFailed(name, message == null ? "" : message.InnerText, stackTrace == null ? "" : stackTrace.InnerText, testId);
                    TC_TestFinished(name, duration, testId);
                    break;
            }
        }
Ejemplo n.º 3
0
        public void TestStarted(XmlNode node)
        {
            string name = node.GetAttribute("fullname");
            string testId = node.GetAttribute("id");

            _outWriter.WriteLine("##teamcity[testStarted name='{0}' captureStandardOutput='true' flowId='{1}']", Escape(name), Escape(testId));
        }
        private static void Summarize(ResultSummary s, XmlNode node)
        {
            string type = node.GetAttribute("type");
            string status = node.GetAttribute("result");
            string label = node.GetAttribute("label");

            switch (node.Name)
            {
                case "test-case":
                    s.TestCount++;

                    switch (status)
                    {
                        case "Passed":
                            s.PassCount++;
                            break;
                        case "Failed":
                            if (label == null)
                                s.FailureCount++;
                            else if (label == "Invalid")
                                s.InvalidCount++;
                            else
                                s.ErrorCount++;
                            break;
                        case "Inconclusive":
                            s.InconclusiveCount++;
                            break;
                        case "Skipped":
                            if (label == "Ignored")
                                s.IgnoreCount++;
                            else if (label == "Explicit")
                                s.ExplicitCount++;
                            else
                                s.SkipCount++;
                            break;
                        default:
                            s.SkipCount++;
                            break;
                    }
                    break;

                case "test-suite":
                    if (type == "Assembly" && status == "Failed" && label == "Invalid")
                        s.InvalidAssemblies++;
                    if (type == "Assembly" && status == "Failed" && label == "Error")
                    {
                        s.InvalidAssemblies++;
                        s.UnexpectedError = true;
                    }

                    Summarize(s, node.ChildNodes);
                    break;

                case "test-run":
                    Summarize(s, node.ChildNodes);
                    break;
            }
        }
Ejemplo n.º 5
0
        private void Summarize(XmlNode node)
        {
            switch (node.Name)
            {
                case "test-case":
                    resultCount++;

                    string outcome = node.GetAttribute("result");
                    string label = node.GetAttribute("label");
                    if (label != null)
                        outcome = label;

                    switch (outcome)
                    {
                        case "Passed":
                            successCount++;
                            testsRun++;
                            break;
                        case "Failed":
                            failureCount++;
                            testsRun++;
                            break;
                        case "Error":
                        case "Cancelled":
                            errorCount++;
                            testsRun++;
                            break;
                        case "Inconclusive":
                            inconclusiveCount++;
                            testsRun++;
                            break;
                        case "NotRunnable": // TODO: Check if this can still occur
                        case "Invalid":
                            notRunnable++;
                            break;
                        case "Ignored":
                            ignoreCount++;
                            break;
                        case "Skipped":
                        default:
                            skipCount++;
                            break;
                    }
                    break;

                //case "test-suite":
                //case "test-fixture":
                //case "method-group":
                default:
                    foreach (XmlNode childResult in node.ChildNodes)
                        Summarize(childResult);
                    break;
            }
        }
Ejemplo n.º 6
0
        public NUnit2ResultSummary(XmlNode result)
        {
            if (result.Name != "test-run")
                throw new InvalidOperationException("Expected <test-run> as top-level element but was <" + result.Name + ">");

            name = result.GetAttribute("name");
            duration = result.GetAttribute("duration", 0.0);
            startTime = result.GetAttribute("start-time", DateTime.MinValue);
            endTime = result.GetAttribute("end-time", DateTime.MaxValue);

            Summarize(result);
        }
Ejemplo n.º 7
0
 public ResultReporter(XmlNode result, ConsoleOptions options)
 {
     this.result = result;
     this.testRunResult = result.GetAttribute("result");
     this.options = options;
     this.summary = new ResultSummary(result);
 }
Ejemplo n.º 8
0
        public List<WebControl> RenderControl(XmlNode xmlControl)
        {
            base.Initialize(xmlControl);

            XmlNode valuesNode = _PropertyMapper.GetValuesNode();

            var firstPass = true;
            var groupName = string.Empty;
            var name = string.Empty;

            foreach (XmlNode xmlValueNode in valuesNode.ChildNodes)
            {
                if (firstPass)
                {
                    firstPass = false;
                    groupName = "Group" + _PropertyMapper.GetName();
                    name = _PropertyMapper.GetID();
                }

                ASPxRadioButton aspxRadioButton = new ASPxRadioButton
                {
                    ID = "rad" + xmlValueNode.GetAttribute("CCLAVE"),
                    Text = xmlValueNode.GetAttribute("CTEXTO"),
                    Value = xmlValueNode.GetAttribute("CCLAVE"),
                    ClientInstanceName = name,
                    Checked = (_PropertyMapper.GetDefault() == xmlValueNode.GetAttribute("CCLAVE")) ? true : false,
                    GroupName = groupName
                };

                try
                {
                    if (xmlControl.GetAttribute("CCONTROLASOC") != null)
                    {
                        aspxRadioButton.ClientSideEvents.CheckedChanged = "function(s, e) { if(s.GetChecked()) {" + xmlControl.GetAttribute("CCONTROLASOC") + ".PerformCallback('" + xmlValueNode.GetAttribute("CCLAVE") + "');} }";
                        aspxRadioButton.ClientSideEvents.Init = "function(s, e) { if(s.GetChecked()) {" + xmlControl.GetAttribute("CCONTROLASOC") + ".PerformCallback('" + xmlValueNode.GetAttribute("CCLAVE") + "');} }";
                    }
                }
                catch (Exception)
                {
                }

                _Controls.Add(aspxRadioButton);
            }

            return _Controls;
        }
 private static Axis ParseAxis(XmlNode axisNode)
 {
     var axis = new Axis();
     axis.Name = ParseJoystickAxis(axisNode);
     axis.Action = ParseJoystickAxisAction(axisNode.InnerText);
     axis.IsInverted = Boolean.Parse(axisNode.GetAttribute("Inverted"));
     return axis;
 }
Ejemplo n.º 10
0
        public Instance Read(XmlNode node, Type pluginType)
        {
            Type elementType = pluginType.GetElementType();
            char delimiter = node.GetAttribute("Delimiter", ",").ToCharArray()[0];

            string valueString = node.GetAttribute("Values", string.Empty);
            string[] rawValues = valueString.Split(new[] {delimiter}, StringSplitOptions.RemoveEmptyEntries);

            Array array = Array.CreateInstance(elementType, rawValues.Length);
            for (int i = 0; i < rawValues.Length; i++)
            {
                object convertedType = Convert.ChangeType(rawValues[i].Trim(), elementType);
                array.SetValue(convertedType, i);
            }

            return new SerializedInstance(array);
        }
Ejemplo n.º 11
0
        public List<WebControl> RenderControl(XmlNode xmlControl)
        {
            base.Initialize(xmlControl);

            ASPxComboBox aspxListBox = new ASPxComboBox
            {
                ID = _PropertyMapper.GetID(),
                ClientInstanceName = _PropertyMapper.GetID()
            };

            if (string.IsNullOrEmpty(_PropertyMapper.GetDefault()))
                aspxListBox.SelectedIndex = 0;

            aspxListBox.Callback += new DevExpress.Web.ASPxClasses.CallbackEventHandlerBase(aspxListBox_Callback);
            XmlNode valuesNode = _PropertyMapper.GetValuesNode();

            // Carga los datos de la lista
            foreach (XmlNode xmlValueNode in valuesNode.ChildNodes)
            {
                ListEditItem listEditItem = new ListEditItem();

                    listEditItem.Value = xmlValueNode.GetAttribute("CCLAVE");
                    listEditItem.Text = xmlValueNode.GetAttribute("CTEXTO");
                    listEditItem.Selected = (_PropertyMapper.GetDefault() == xmlValueNode.GetAttribute("CCLAVE")) ? true : false;

                    aspxListBox.Items.Add(listEditItem);

            }

            try
            {
                if (xmlControl.GetAttribute("CCONTROLASOC") != null)
                {
                    aspxListBox.ClientSideEvents.ValueChanged = "function(s, e) {" + xmlControl.GetAttribute("CCONTROLASOC") + ".PerformCallback(" + _PropertyMapper.GetID() + ".GetValue());}";
                    aspxListBox.ClientSideEvents.Init = "function(s, e) {" + xmlControl.GetAttribute("CCONTROLASOC") + ".PerformCallback(" + _PropertyMapper.GetID() + ".GetValue());}";
                }
            }
            catch (Exception)
            {
            }

            _Controls.Add(aspxListBox);

            return _Controls;
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 解析 XmlNode 为 model
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 private static ToDoModel parseNoteNode(XmlNode node)
 {
     return new ToDoModel()
     {
         Deadline = DateTime.Parse(node.SelectSingleNode("deadline").GetInnerText()),
         Content = node.SelectSingleNode("content").GetInnerText(),
         IsDo = node.GetAttribute("isdo", "0") == "1"
     };
 }
        private static JoystickSetup ParseJoystickSetup(XmlNode joystickSetupNode)
        {
            var setup = new JoystickSetup();
            setup.Name = joystickSetupNode.GetAttribute("Name");
            XmlNodeList deviceNodes = joystickSetupNode.SelectNodes("JoystickDevice");

            foreach (XmlNode deviceNode in deviceNodes)
                setup.Devices.Add(ParseDevice(deviceNode));

            return setup;
        }
 private static JoystickDevice ParseDevice(XmlNode deviceNode)
 {
     var device = new JoystickDevice();
     device.Name = deviceNode.GetAttribute("Name");
     XmlNodeList axisNodes = deviceNode.SelectNodes("Axis");
     foreach (XmlNode axisNode in axisNodes)
     {
         if (!String.IsNullOrEmpty(axisNode.ToString()))
             device.Axes.Add(ParseAxis(axisNode));
     }
     return device;
 }
Ejemplo n.º 15
0
 private static NoteModel parseNoteNode(XmlNode noteNode)
 {
     return new NoteModel()
         {
             Keywords = noteNode.SelectSingleNode("keyword").GetInnerText(),
             Title = noteNode.SelectSingleNode("title").GetInnerText(),
             Content = noteNode.SelectSingleNode("content").GetInnerText(),
             IsRead = noteNode.GetAttribute("isread", 0) == "1",
             Type = int.Parse(noteNode.SelectSingleNode("type").GetInnerText()),
             CreateTime =DateTime.Parse(noteNode.SelectSingleNode("createtime").GetInnerText())
         };
 }
        private static PIDSetup ParsePIDSetup(XmlNode pidSetupNode)
        {
            var result = new PIDSetup();
            result.Name = pidSetupNode.GetAttribute("Name");
            result.PitchAngle = ParsePID(pidSetupNode.SelectSingleNode("PID[@Name='PitchAngle']"));
            result.RollAngle = ParsePID(pidSetupNode.SelectSingleNode("PID[@Name='RollAngle']"));
            result.YawAngle = ParsePID(pidSetupNode.SelectSingleNode("PID[@Name='YawAngle']"));
            result.Throttle = ParsePID(pidSetupNode.SelectSingleNode("PID[@Name='Throttle']"));
            result.ForwardsAccel = ParsePID(pidSetupNode.SelectSingleNode("PID[@Name='Velocity']"));
            result.RightwardsAccel = ParsePID(pidSetupNode.SelectSingleNode("PID[@Name='Velocity']"));

            return result;
        }
        public ResultReporter(XmlNode result, TextWriter writer, HostedOptions options)
        {
            _result = result;
            _writer = writer;

            _overallResult = result.GetAttribute("result");
            if (_overallResult == "Skipped")
                _overallResult = "Warning";

            _options = options;

            Summary = ReadResultSummary(result);
        }
Ejemplo n.º 18
0
        public ResultReporter(XmlNode result, ExtendedTextWriter writer, ConsoleOptions options)
        {
            _result = result;
            _writer = writer;

            _overallResult = result.GetAttribute("result");
            if (_overallResult == "Skipped")
                _overallResult = "Warning";

            _options = options;

            Summary = new ResultSummary(result);
        }
Ejemplo n.º 19
0
        public VSTestResult ConvertTestResult(XmlNode resultNode)
        {
            TestCase ourCase = GetCachedTestCase(resultNode.GetAttribute("id"));
            if (ourCase == null) return null;

            VSTestResult ourResult = new VSTestResult(ourCase)
            {
                DisplayName = ourCase.DisplayName,
                Outcome = GetTestOutcome(resultNode),
                Duration = TimeSpan.FromSeconds(resultNode.GetAttribute("duration", 0.0))
            };

            var startTime = resultNode.GetAttribute("start-time");
            if (startTime != null)
                ourResult.StartTime = DateTimeOffset.Parse(startTime);

            var endTime = resultNode.GetAttribute("end-time");
            if (endTime != null)
                ourResult.EndTime = DateTimeOffset.Parse(endTime);

            // TODO: Remove this when NUnit provides a better duration
            if (ourResult.Duration == TimeSpan.Zero && (ourResult.Outcome == TestOutcome.Passed || ourResult.Outcome == TestOutcome.Failed))
                ourResult.Duration = TimeSpan.FromTicks(1);

            ourResult.ComputerName = Environment.MachineName;

            ourResult.ErrorMessage = GetErrorMessage(resultNode);

            XmlNode stackTraceNode = resultNode.SelectSingleNode("failure/stack-trace");
            if (stackTraceNode != null)
                ourResult.ErrorStackTrace = stackTraceNode.InnerText;

            XmlNode outputNode = resultNode.SelectSingleNode("output");
            if (outputNode != null)
                ourResult.Messages.Add(new TestResultMessage(TestResultMessage.StandardOutCategory, outputNode.InnerText));

            return ourResult;
        }
 public override SingleWorkflowStep Create(string workflowType, XmlNode node)
 {
     SingleWorkflowStep toret = null;
     switch (workflowType)
     {
         case ("STEPSAMPLE"):
             {
                 toret = new StepSampleStep
                 {
                     Value = node.GetAttribute("value")
                 };
             }
             break;
         case ("UNDOSTEPSAMPLE"):
             {
                 toret = new UndoStepSampleStep
                 {
                     Value = node.GetAttribute("value")
                 };
             }
             break;
     }
     return toret;
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Converts an NUnit test into a TestCase for Visual Studio,
        /// using the best method available according to the exact
        /// type passed and caching results for efficiency.
        /// </summary>
        public TestCase ConvertTestCase(XmlNode testNode)
        {
            if (testNode == null || testNode.Name != "test-case")
                throw new ArgumentException("The argument must be a test case", "test");

            // Return cached value if we have one
            string id = testNode.GetAttribute("id");
            if (vsTestCaseMap.ContainsKey(id))
                return vsTestCaseMap[id];
           
            // Convert to VS TestCase and cache the result
            var testCase = MakeTestCaseFromXmlNode(testNode);
            vsTestCaseMap.Add(id, testCase);
            return testCase;             
        }
        private static PID ParsePID(XmlNode node)
        {
            if (node == null) throw new ArgumentNullException("node");

            float[] pidValues = XMLHelper.ParseAttributesFloat(node, "P", "I", "D");
            if (pidValues == null || pidValues.Length != 3)
                throw new Exception("Unexpected error parsing XML attributes for PID.");

            return new PID
                       {
                           Name = node.GetAttribute("Name"),
                           P = Convert.ToSingle(pidValues[0]),
                           I = Convert.ToSingle(pidValues[1]),
                           D = Convert.ToSingle(pidValues[2]),
                       };
        }
Ejemplo n.º 23
0
        private void Summarize(XmlNode node)
        {
            string type = node.GetAttribute("type");
            string status = node.GetAttribute("result");
            string label = node.GetAttribute("label");

            switch (node.Name)
            {
                case "test-case":
                    TestCount++;

                    switch (status)
                    {
                        case "Passed":
                            PassCount++;
                            break;
                        case "Failed":
                            if (label == null)
                                FailureCount++;
                            else if (label == "Invalid")
                                InvalidCount++;
                            else
                                ErrorCount++;
                            break;
                        case "Inconclusive":
                            InconclusiveCount++;
                            break;
                        case "Skipped":
                            if (label == "Ignored")
                                IgnoreCount++;
                            else if (label == "Explicit")
                                ExplicitCount++;
                            else
                                SkipCount++;
                            break;
                        default:
                            SkipCount++;
                            break;
                    }
                    break;

                case "test-suite":
                    if (status == "Failed" && label == "Invalid")
                    {
                        if (type == "Assembly") InvalidAssemblies++;
                        else InvalidTestFixtures++;
                    }
                    if (type == "Assembly" && status == "Failed" && label == "Error")
                    {
                        InvalidAssemblies++;
                        UnexpectedError = true;
                    }

                    Summarize(node.ChildNodes);
                    break;

                case "test-run":
                    Summarize(node.ChildNodes);
                    break;
            }
        }
Ejemplo n.º 24
0
        private void WriteNotRunResults(XmlNode result)
        {
            switch (result.Name)
            {
                case "test-case":
                    string status = result.GetAttribute("result");

                    if (status == "Skipped")
                    {
                        string label = result.GetAttribute("label");

                        var colorStyle = label == "Ignored" 
                            ? ColorStyle.Warning 
                            : ColorStyle.Output;

                        WriteSingleResult(result, colorStyle);
                    }

                    break;

                case "test-suite":
                case "test-run":
                    foreach (XmlNode childResult in result.ChildNodes)
                        WriteNotRunResults(childResult);

                    break;
            }
        }
Ejemplo n.º 25
0
        private void WriteSingleResult(XmlNode result, ColorStyle colorStyle)
        {
            string status = result.GetAttribute("label");
            if (status == null)
                status = result.GetAttribute("result");

            if (status == "Failed" || status == "Error")
            {
                var site = result.GetAttribute("site");
                if (site == "SetUp" || site == "TearDown")
                    status = site + " " + status;
            }

            string fullName = result.GetAttribute("fullname");

            _writer.WriteLine(colorStyle,
                string.Format("{0}) {1} : {2}", ++_reportIndex, status, fullName));

            XmlNode failureNode = result.SelectSingleNode("failure");
            if (failureNode != null)
            {
                XmlNode message = failureNode.SelectSingleNode("message");
                XmlNode stacktrace = failureNode.SelectSingleNode("stack-trace");

                // In order to control the format, we trim any line-end chars
                // from end of the strings we write and supply them via calls
                // to WriteLine(). Newlines within the strings are retained.

                if (message != null)
                    _writer.WriteLine(colorStyle, message.InnerText.TrimEnd(EOL_CHARS));

                if (stacktrace != null)
                    _writer.WriteLine(colorStyle, stacktrace.InnerText.TrimEnd(EOL_CHARS));
            }

            XmlNode reasonNode = result.SelectSingleNode("reason");
            if (reasonNode != null)
            {
                XmlNode message = reasonNode.SelectSingleNode("message");

                if (message != null)
                    _writer.WriteLine(colorStyle, message.InnerText.TrimEnd(EOL_CHARS));
            }

            _writer.WriteLine(); // Skip after each item
        }
Ejemplo n.º 26
0
        private void WriteErrorsAndFailures(XmlNode result)
        {
            string resultState = result.GetAttribute("result");

            switch (result.Name)
            {
                case "test-case":
                    if (resultState == "Failed")
                        WriteSingleResult(result, ColorStyle.Failure);
                    return;

                case "test-run":
                    foreach (XmlNode childResult in result.ChildNodes)
                        WriteErrorsAndFailures(childResult);
                    break;

                case "test-suite":
                    if (resultState == "Failed")
                    {
                        if (result.GetAttribute("type") == "Theory")
                        {
                            WriteSingleResult(result, ColorStyle.Failure);
                        }
                        else
                        {
                            var site = result.GetAttribute("site");
                            if (site != "Parent" && site != "Child")
                                WriteSingleResult(result, ColorStyle.Failure);
                            if (site == "SetUp") return;
                        }
                    }
                    
                    foreach (XmlNode childResult in result.ChildNodes)
                        WriteErrorsAndFailures(childResult);

                    break;
            }
        }
Ejemplo n.º 27
0
        public void RegisterMessage(XmlNode testEvent)
        {
            if (testEvent == null)
            {
                throw new ArgumentNullException("message");
            }

            var messageName = testEvent.Name;
            if (string.IsNullOrEmpty(messageName))
            {
                return;
            }

            messageName = messageName.ToLowerInvariant();
            if (messageName == "start-run")
            {
                _refs.Clear();
                return;
            }

            var fullName = testEvent.GetAttribute("fullname");
            if (string.IsNullOrEmpty(fullName))
            {
                return;
            }

            var id = testEvent.GetAttribute("id");
            var parentId = testEvent.GetAttribute("parentId");
            string flowId;
            if (parentId != null)
            {
                // NUnit 3 case
                string rootId;
                flowId = TryFindRootId(parentId, out rootId) ? rootId : id;
            }
            else
            {
                // NUnit 2 case
                flowId = _rootFlowId;
            }

            string testFlowId;
            if (id != flowId && parentId != null)
            {
                testFlowId = id;
            }
            else
            {
                testFlowId = flowId;
                if (testFlowId == null)
                {
                    testFlowId = id;
                }
            }

            switch (messageName.ToLowerInvariant())
            {
                case "start-suite":
                    _refs[id] = parentId;
                    StartSuiteCase(id, parentId, flowId, fullName);
                    break;

                case "test-suite":
                    _refs.Remove(id);
                    TestSuiteCase(id, parentId, flowId, fullName);
                    break;

                case "start-test":
                    _refs[id] = parentId;
                    CaseStartTest(id, flowId, parentId, testFlowId, fullName);
                    break;

                case "test-case":
                    try
                    {
                        if (!_refs.Remove(id))
                        {
                            // When test without starting
                            CaseStartTest(id, flowId, parentId, testFlowId, fullName);
                        }

                        var result = testEvent.GetAttribute("result");
                        if (string.IsNullOrEmpty(result))
                        {
                            break;
                        }

                        switch (result.ToLowerInvariant())
                        {
                            case "passed":
                                OnTestFinished(testFlowId, testEvent, fullName);
                                break;

                            case "inconclusive":
                                OnTestInconclusive(testFlowId, testEvent, fullName);
                                break;

                            case "skipped":
                                OnTestSkipped(testFlowId, testEvent, fullName);
                                break;

                            case "failed":
                                OnTestFailed(testFlowId, testEvent, fullName);
                                break;
                        }
                    }
                    finally
                    {
                        if (id != flowId && parentId != null)
                        {
                            OnFlowFinished(id);
                        }
                    }

                    break;
            }
        }
Ejemplo n.º 28
0
        private void OnTestFinished(string flowId, XmlNode message, string fullName)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            var durationStr = message.GetAttribute("duration");
            double durationDecimal;
            int durationMilliseconds = 0;
            if (durationStr != null && double.TryParse(durationStr, NumberStyles.Any, CultureInfo.InvariantCulture, out durationDecimal))
            {
                durationMilliseconds = (int)(durationDecimal * 1000d);
            }

            TrySendOutput(flowId, message, fullName);
            WriteLine(
                "##teamcity[testFinished name='{0}' duration='{1}' flowId='{2}']",
                fullName,
                durationMilliseconds.ToString(),
                flowId);
        }
        private static TerrainInfo ParseTerrainInfo(XmlNode terrainInfoNode)
        {
            var result = new TerrainInfo();

            try { result.Width = int.Parse(terrainInfoNode.GetAttribute("Width")); }
            catch { result.Width = 256; }

            try { result.MinHeight = int.Parse(terrainInfoNode.GetAttribute("MinHeight")); }
            catch { result.MinHeight = 0; }

            try { result.MaxHeight = int.Parse(terrainInfoNode.GetAttribute("MaxHeight")); }
            catch { result.MaxHeight = 20; }

            return result;
        }
        private static Scenario ParseScenario(XmlNode scenarioNode)
        {
            var scenario = new Scenario();
            scenario.Name = scenarioNode.GetAttribute("Name");
            scenario.BackgroundMusic = ParseBackgroundMusic(scenarioNode.SelectSingleNode("BackgroundMusic"));
            scenario.SceneElements = ParseSceneElements(scenarioNode.SelectSingleNode("Scene"));
            scenario.CameraType = ParseCameraType(scenarioNode.SelectSingleNode("CameraType"));
            scenario.Timeout = ParseTimeout(scenarioNode.SelectSingleNode("TimeoutSeconds"));

            XmlNode terrainInfoNode = scenarioNode.SelectSingleNode("Scene").SelectSingleNode("Terrain");
            if (terrainInfoNode != null)
                scenario.TerrainInfo = ParseTerrainInfo(terrainInfoNode);

            scenario.HelicopterScenarios = ParseHelicopterScenario(scenarioNode);
            return scenario;
        }