public void SerializeElement(XmlElement parent, IUnitTestElement element)
 {
     parent.SetAttribute("type", element.GetType().Name);
     
     var testElement = element as XunitTestElementBase;
     if (testElement == null)
         throw new ArgumentException(string.Format("Element {0} is not MSTest", element.GetType()), "element");
     
     testElement.WriteToXml(parent);
 }
Esempio n. 2
0
        public bool Equals(IUnitTestElement other)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (other.GetType() == this.GetType())
            {
                var    element = (Element)other;
                string thisFullName;
                string otherFullName;
                try
                {
                    // This might throw for invalid elements.
                    thisFullName  = this._declaringTypeName.FullName;
                    otherFullName = element._declaringTypeName.FullName;
                }
                catch (NullReferenceException)
                {
                    return(false);
                }

                return(Equals(other.Id, this.Id) &&
                       other.ShortName == this.ShortName &&
                       Equals(element._projectEnvoy, this._projectEnvoy) &&
                       thisFullName == otherFullName);
            }
            return(false);
        }
            public void SerializeElement(XmlElement parent, IUnitTestElement element)
            {
                parent.SetAttribute("type", element.GetType().Name);

                var writableUnitTestElement = (ISerializableUnitTestElement)element;
                writableUnitTestElement.WriteToXml(parent);
            }
Esempio n. 4
0
 public void SerializeElement(XmlElement xmlElement, IUnitTestElement element)
 {
     xmlElement.SetAttribute(c_elementType, element.GetType().FullName);
     xmlElement.SetAttribute(c_absoluteId, element.Id);
     xmlElement.SetAttribute(c_projectId, ((ITestElement)element).GetProject().AssertNotNull().GetPersistentID());
     xmlElement.SetAttribute(c_text, element.GetPresentation());
 }
Esempio n. 5
0
 public void SerializeElement([NotNull] XmlElement xmlElement, [NotNull] IUnitTestElement element)
 {
     xmlElement.SetAttribute(c_elementType, element.GetType().FullName);
     xmlElement.SetAttribute(c_absoluteId, element.Id);
     xmlElement.SetAttribute(c_projectId, ObjectExtensions.NotNull(((ITestElement)element).GetProject()).GetPersistentID());
     xmlElement.SetAttribute(c_text, element.GetPresentation());
     xmlElement.SetAttribute(c_categories, element.Categories.Select(x => x.Name).Join("|"));
 }
        public void SerializeElement(XmlElement parent, IUnitTestElement element)
        {
            parent.SetAttribute(TypeAttribute, element.GetType().Name);

            var specificationElement = element as JasmineSpecificationElement;
            if (specificationElement != null)
            {
                specificationElement.WriteToXml(parent);
                return;
            }

            if (!(element is JasmineSuiteElement))
            {
                throw new ArgumentException(string.Format("Element {0} is not Jasmine", element.GetType()));
            }

            ((JasmineSuiteElement)element).WriteToXml(parent);
        }
        public void SerializeElement(XmlElement parent, IUnitTestElement element)
        {
            parent.SetAttribute("type", element.GetType().Name);

            // Make sure that the element is actually ours before trying to serialise it
            // This can happen if there are two providers with the same "xunit" id installed
            var writableUnitTestElement = element as ISerializableUnitTestElement;
            if (writableUnitTestElement != null)
                writableUnitTestElement.WriteToXml(parent);
        }
Esempio n. 8
0
        public void SerializeElement(XmlElement parent, IUnitTestElement element)
        {
            parent.SetAttribute("type", element.GetType().Name);

            // Make sure that the element is actually ours before trying to serialise it
            // This can happen if there are two providers with the same "Fixie" id installed
            var writableUnitTestElement = element as ISerializableUnitTestElement;

            if (writableUnitTestElement != null)
            {
                writableUnitTestElement.WriteToXml(parent);
            }
        }
Esempio n. 9
0
        public bool Equals(IUnitTestElement other)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (other.GetType() == GetType())
            {
                var element = (Element)other;
                return(other.ShortName == ShortName &&
                       other.Provider == Provider &&
                       Equals(element._projectEnvoy, _projectEnvoy) &&
                       element._declaringTypeName == _declaringTypeName);
            }
            return(false);
        }
        public void SerializeElement(XmlElement parent, IUnitTestElement element)
        {
            parent.SetAttribute(TypeAttribute, element.GetType().Name);

            var specificationElement = element as JasmineSpecificationElement;

            if (specificationElement != null)
            {
                specificationElement.WriteToXml(parent);
                return;
            }

            if (!(element is JasmineSuiteElement))
            {
                throw new ArgumentException(string.Format("Element {0} is not Jasmine", element.GetType()));
            }

            ((JasmineSuiteElement)element).WriteToXml(parent);
        }
Esempio n. 11
0
        public virtual bool Equals(IUnitTestElement other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }
            if (other.GetType() != GetType())
            {
                return(false);
            }

            return(Equals(ProjectFileEnvoy, ((Element)other).ProjectFileEnvoy) &&
                   string.Equals(ShortName, other.ShortName) &&
                   Equals(Parent, other.Parent));
        }
        public bool Equals(IUnitTestElement other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (other.GetType() == this.GetType())
            {
                var    element = (Element)other;
                string thisFullName;
                string otherFullName;
                try
                {
                    // This might throw for invalid elements.
                    thisFullName  = this._declaringTypeName.FullName;
                    otherFullName = element._declaringTypeName.FullName;
                }
                catch (NullReferenceException)
                {
                    Debug.Fail("Should not happen as the type name should be persisted!");
                    return(false);
                }

                return(Equals(other.Id, this.Id) &&
                       other.ShortName == this.ShortName &&
                       thisFullName == otherFullName);
            }

            return(false);
        }
Esempio n. 13
0
    public bool Equals(IUnitTestElement other)
    {
      if (ReferenceEquals(this, other))
      {
        return true;
      }

      if (other.GetType() == GetType())
      {
        var element = (Element) other;
        return other.ShortName == ShortName
               && other.Provider == Provider
               && Equals(element._projectEnvoy, _projectEnvoy)
               && element._declaringTypeName == _declaringTypeName;
      }
      return false;
    }
Esempio n. 14
0
 public void SerializeElement(XmlElement xmlElement, IUnitTestElement element)
 {
     xmlElement.SetAttribute(c_elementType, element.GetType().FullName);
       xmlElement.SetAttribute(c_absoluteId, element.Id);
       xmlElement.SetAttribute(c_projectId, ((ITestElement) element).GetProject().AssertNotNull().GetPersistentID());
       xmlElement.SetAttribute(c_text, element.GetPresentation());
       xmlElement.SetAttribute(c_categories, element.Categories.Select(x => x.Name).Join("|"));
 }
        public bool Equals(IUnitTestElement other)
        {
            if (ReferenceEquals(this, other))
            {
                return true;
            }

            if (other.GetType() == this.GetType())
            {
                var element = (Element)other;
                string thisFullName;
                string otherFullName;
                try
                {
                    // This might throw for invalid elements.
                    thisFullName = this._declaringTypeName.FullName;
                    otherFullName = element._declaringTypeName.FullName;
                }
                catch (NullReferenceException)
                {
                    return false;
                }

                return Equals(other.Id, this.Id)
                       && other.ShortName == this.ShortName
                       && Equals(element._projectEnvoy, this._projectEnvoy)
                       && thisFullName == otherFullName;
            }
            return false;
        }
Esempio n. 16
0
        public virtual bool Equals(IUnitTestElement other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }
            if (ReferenceEquals(this, other))
            {
                return true;
            }
            if (other.GetType() != GetType())
            {
                return false;
            }

            return Equals(ProjectFileEnvoy, ((Element)other).ProjectFileEnvoy) &&
                   string.Equals(ShortName, other.ShortName) &&
                   Equals(Parent, other.Parent);
        }