public object Visit(ResultCellData n) { if (this.root == null) { return(false); } var locationElement = root.Element(XName.Get("Location")); n.Location = (locationElement != null) ? locationElement.Value : String.Empty; var contentElement = root.Element(XName.Get("Content")); n.Content = (contentElement != null) ? contentElement.Value : String.Empty; var cellTypeElement = root.Element(XName.Get("CellType")); if (cellTypeElement != null) { n.CellType = (TestInputType)Enum.Parse(typeof(TestInputType), cellTypeElement.Value.ToUpper()); } var differenceUpElement = root.Element(XName.Get("differenceUp")); n.DifferenceUp = (differenceUpElement != null) ? Double.Parse(differenceUpElement.Value) : Properties.Settings.Default.StandartDifference; var differenceDownElement = root.Element(XName.Get("differenceDown")); n.DifferenceDown = (differenceDownElement != null) ? Double.Parse(differenceDownElement.Value) : Properties.Settings.Default.StandartDifference; return(true); }
public object Visit(Scenario n) { if (this.root == null) return false; var titleAttribute = root.Attribute(XName.Get("Title")); n.Title = (titleAttribute != null) ? titleAttribute.Value : String.Empty; var descriptionAttribute = root.Attribute(XName.Get("Description")); n.Description = (descriptionAttribute != null) ? descriptionAttribute.Value : String.Empty; var authorAttribute = root.Attribute(XName.Get("Author")); n.Author = (authorAttribute != null) ? authorAttribute.Value : String.Empty; var creationDateAttribute = root.Attribute(XName.Get("CreationDate")); n.CrationDate = (creationDateAttribute != null) ? Convert.ToDateTime(creationDateAttribute.Value) : DateTime.Now; var ratingAttribute = root.Attribute(XName.Get("Rating")); n.Rating = (ratingAttribute != null) ? Convert.ToDouble(ratingAttribute.Value) : 0.0; //inputs var inputElements = root.Element(XName.Get("Inputs")); if (inputElements != null) { foreach (var inputElement in inputElements.Elements()) { var newInput = new InputCellData(); newInput.Accept(new XMLToScenarioVisitor(inputElement)); n.Inputs.Add(newInput); } } //intermediates var intermediateElements = root.Element(XName.Get("Intermediates")); if (intermediateElements != null) { foreach (var intermediateElement in intermediateElements.Elements()) { var newIntermediate = new IntermediateCellData(); newIntermediate.Accept(new XMLToScenarioVisitor(intermediateElement)); n.Intermediates.Add(newIntermediate); } } //results var resultElements = root.Element(XName.Get("Results")); if (resultElements != null) { foreach (var resultElement in resultElements.Elements()) { var newResult = new ResultCellData(); newResult.Accept(new XMLToScenarioVisitor(resultElement)); n.Results.Add(newResult); } } return true; }
public object Visit(ResultCellData n) { var root = new XElement("resultCellData"); if (n.Location != null) root.Add(new XElement("Location", n.Location)); if (n.Content != null) root.Add(new XElement("Content", n.Content)); root.Add(new XElement("CellType", n.CellType)); root.Add(new XElement("differenceUp", n.DifferenceUp)); root.Add(new XElement("differenceDown", n.DifferenceDown)); return root; }
private bool IsNotNull(ResultCellData n) { var result = true; if (n.Location == null) { result = false; } if (n.Content == null) { result = false; } return(result); }
public object Visit(ResultCellData n) { var root = new XElement("resultCellData"); if (n.Location != null) { root.Add(new XElement("Location", n.Location)); } if (n.Content != null) { root.Add(new XElement("Content", n.Content)); } root.Add(new XElement("CellType", n.CellType)); root.Add(new XElement("differenceUp", n.DifferenceUp)); root.Add(new XElement("differenceDown", n.DifferenceDown)); return(root); }
public object Visit(ResultCellData n) { throw new NotImplementedException(); }
private bool IsNotNull(ResultCellData n) { var result = true; if (n.Location == null) result = false; if (n.Content == null) result = false; return result; }
public object Visit(ResultCellData n) { if (this.root == null) return false; var locationElement = root.Element(XName.Get("Location")); n.Location = (locationElement != null) ? locationElement.Value : String.Empty; var contentElement = root.Element(XName.Get("Content")); n.Content = (contentElement != null) ? contentElement.Value : String.Empty; var cellTypeElement = root.Element(XName.Get("CellType")); if (cellTypeElement != null) { n.CellType = (TestInputType)Enum.Parse(typeof(TestInputType), cellTypeElement.Value.ToUpper()); } var differenceUpElement = root.Element(XName.Get("differenceUp")); n.DifferenceUp = (differenceUpElement != null) ? Double.Parse(differenceUpElement.Value) : Properties.Settings.Default.StandartDifference; var differenceDownElement = root.Element(XName.Get("differenceDown")); n.DifferenceDown = (differenceDownElement != null) ? Double.Parse(differenceDownElement.Value) : Properties.Settings.Default.StandartDifference; return true; }
public object Visit(Scenario n) { if (this.root == null) { return(false); } var titleAttribute = root.Attribute(XName.Get("Title")); n.Title = (titleAttribute != null) ? titleAttribute.Value : String.Empty; var descriptionAttribute = root.Attribute(XName.Get("Description")); n.Description = (descriptionAttribute != null) ? descriptionAttribute.Value : String.Empty; var authorAttribute = root.Attribute(XName.Get("Author")); n.Author = (authorAttribute != null) ? authorAttribute.Value : String.Empty; var creationDateAttribute = root.Attribute(XName.Get("CreationDate")); n.CrationDate = (creationDateAttribute != null) ? Convert.ToDateTime(creationDateAttribute.Value) : DateTime.Now; var ratingAttribute = root.Attribute(XName.Get("Rating")); n.Rating = (ratingAttribute != null) ? Convert.ToDouble(ratingAttribute.Value) : 0.0; //inputs var inputElements = root.Element(XName.Get("Inputs")); if (inputElements != null) { foreach (var inputElement in inputElements.Elements()) { var newInput = new InputCellData(); newInput.Accept(new XMLToScenarioVisitor(inputElement)); n.Inputs.Add(newInput); } } //intermediates var intermediateElements = root.Element(XName.Get("Intermediates")); if (intermediateElements != null) { foreach (var intermediateElement in intermediateElements.Elements()) { var newIntermediate = new IntermediateCellData(); newIntermediate.Accept(new XMLToScenarioVisitor(intermediateElement)); n.Intermediates.Add(newIntermediate); } } //results var resultElements = root.Element(XName.Get("Results")); if (resultElements != null) { foreach (var resultElement in resultElements.Elements()) { var newResult = new ResultCellData(); newResult.Accept(new XMLToScenarioVisitor(resultElement)); n.Results.Add(newResult); } } return(true); }