public IUnitTestElement DeserializeElement(XmlElement parent, IUnitTestElement parentElement)
        {
            if (!parent.HasAttribute(TypeAttribute))
            {
                throw new ArgumentException("Element is not Jasmine");
            }
            switch (parent.GetAttribute(TypeAttribute))
            {
            case "JasmineSuiteElement":
                return(JasmineSuiteElement.ReadFromXml(parent, parentElement, _factory, _solution));

            case "JasmineSpecificationElement":
                return(JasmineSpecificationElement.ReadFromXml(parent, parentElement, _factory, _solution));
            }
            throw new ArgumentException("Element is not Jasmine");
        }
示例#2
0
        public JasmineSuiteElement GetOrCreateSuite(IProject project, ProjectModelElementEnvoy projectFileEnvoy,
                                                    string suiteName, JasmineSuiteElement parentSuite, TextRange textRange, IList <string> referencedFiles)
        {
            var id          = string.Format("{0}:{1}", (parentSuite != null) ? parentSuite.Id : _provider.TestProvider.ID, suiteName);
            var elementById = _unitTestElementManager.GetElementById(project, id) as JasmineSuiteElement;

            if (elementById != null)
            {
                elementById.ReferencedFiles = referencedFiles;
                elementById.TextRange       = textRange;
                elementById.State           = UnitTestElementState.Valid;
                elementById.Parent          = parentSuite;
                return(elementById);
            }
            return(new JasmineSuiteElement(_provider, suiteName, parentSuite, projectFileEnvoy, textRange, referencedFiles));
        }