Пример #1
0
        public object Visit(IntermediateCellData 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);
        }
Пример #2
0
        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;
        }
Пример #3
0
        public object Visit(IntermediateCellData n)
        {
            var root = new XElement("IntermediateCellData");
            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;
        }
Пример #4
0
        private bool IsNotNull(IntermediateCellData n)
        {
            var result = true;

            if (n.Location == null)
            {
                result = false;
            }
            if (n.Content == null)
            {
                result = false;
            }

            return(result);
        }
Пример #5
0
        public object Visit(IntermediateCellData n)
        {
            var root = new XElement("IntermediateCellData");

            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);
        }
Пример #6
0
 public object Visit(IntermediateCellData n)
 {
     throw new NotImplementedException();
 }
Пример #7
0
 public object Visit(IntermediateCellData n)
 {
     throw new NotImplementedException();
 }
Пример #8
0
        private bool IsNotNull(IntermediateCellData n)
        {
            var result = true;

            if (n.Location == null) result = false;
            if (n.Content == null) result = false;

            return result;
        }
Пример #9
0
        public object Visit(IntermediateCellData 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;
        }
Пример #10
0
        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);
        }