public static IUnitTestElement ReadFromXml(XmlElement parent,
                                               IUnitTestElement parentElement,
                                               ISolution solution,
                                               BehaviorSpecificationFactory factory)
    {
      var projectId = parent.GetAttribute("projectId");
      var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;
      if (project == null)
      {
        return null;
      }

      var behavior = parentElement as BehaviorElement;
      if (behavior == null)
      {
        return null;
      }

      var typeName = parent.GetAttribute("typeName");
      var methodName = parent.GetAttribute("methodName");
      var isIgnored = bool.Parse(parent.GetAttribute("isIgnored"));

      return factory.GetOrCreateBehaviorSpecification(behavior,
                                                      new ClrTypeName(typeName),
                                                      methodName,
                                                      isIgnored);
    }
 private static XunitTestClassElement AssertTestClass(IUnitTestElement unitTestElement, object shortName)
 {
     Assert.IsInstanceOf<XunitTestClassElement>(unitTestElement);
     Assert.AreEqual(shortName, unitTestElement.ShortName);
     Assert.AreEqual(UnitTestElementState.Valid, unitTestElement.State);
     return (XunitTestClassElement) unitTestElement;
 }
    public IUnitTestElement DeserializeElement(XmlElement parent, IUnitTestElement parentElement)
    {
      var typeName = parent.GetAttribute("elementType");

      if (Equals(typeName, "ContextElement"))
      {
        return ContextElement.ReadFromXml(parent,
                                          _solution,
                                          _contextFactory);
      }
      if (Equals(typeName, "BehaviorElement"))
      {
        return BehaviorElement.ReadFromXml(parent,
                                           parentElement,
                                           _solution,
                                           _behaviorFactory);
      }
      if (Equals(typeName, "BehaviorSpecificationElement"))
      {
        return BehaviorSpecificationElement.ReadFromXml(parent,
                                                        parentElement,
                                                        _solution,
                                                        _behaviorSpecificationFactory);
      }
      if (Equals(typeName, "ContextSpecificationElement"))
      {
        return ContextSpecificationElement.ReadFromXml(parent,
                                                       parentElement,
                                                       _solution,
                                                       _contextSpecificationFactory);
      }

      return null;
    }
 public void Present(IUnitTestElement element, IPresentableItem item, TreeModelNode node, PresentationState state)
 {
     if (element is Element)
     {
         this._presenter.UpdateItem(element, node, item, state);
     }
 }
    public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider)
    {
      var projectId = parent.GetAttribute("projectId");
      var project = ProjectUtil.FindProjectElementByPersistentID(provider.Solution, projectId) as IProject;
      if (project == null)
      {
        return null;
      }

      var context = parentElement as ContextElement;
      if (context == null)
      {
        return null;
      }

      var typeName = parent.GetAttribute("typeName");
      var methodName = parent.GetAttribute("methodName");
      var isIgnored = bool.Parse(parent.GetAttribute("isIgnored"));
      var fullyQualifiedTypeName = parent.GetAttribute("typeFQN");

      return Factories.BehaviorFactory.GetOrCreateBehavior(provider,
                                                           project,
                                                           ProjectModelElementEnvoy.Create(project),
                                                           context,
                                                           typeName,
                                                           methodName,
                                                           isIgnored,
                                                           fullyQualifiedTypeName);
    }
 private static XunitTestMethodElement AssertTestMethod(IUnitTestElement unitTestElement, string shortName)
 {
     Assert.IsInstanceOf<XunitTestMethodElement>(unitTestElement);
     Assert.AreEqual(shortName, unitTestElement.ShortName);
     Assert.AreEqual(UnitTestElementState.Valid, unitTestElement.State);
     return (XunitTestMethodElement) unitTestElement;
 }
    public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution
#if RESHARPER_61
      , IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager
#endif
      )
    {
      var projectId = parent.GetAttribute("projectId");
      var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;
      if (project == null)
      {
        return null;
      }

      var behavior = parentElement as BehaviorElement;
      if (behavior == null)
      {
        return null;
      }

      var typeName = parent.GetAttribute("typeName");
      var methodName = parent.GetAttribute("methodName");
      var isIgnored = bool.Parse(parent.GetAttribute("isIgnored"));

      return BehaviorSpecificationFactory.GetOrCreateBehaviorSpecification(provider,
#if RESHARPER_61
        manager, psiModuleManager, cacheManager,
#endif
        project, behavior, ProjectModelElementEnvoy.Create(project), typeName, methodName, isIgnored);
    }
    public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution
#if RESHARPER_61
      , IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager
#endif
      )
    {
      var projectId = parent.GetAttribute("projectId");
      var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;
      if (project == null)
      {
        return null;
      }

      var context = parentElement as ContextElement;
      if (context == null)
      {
        return null;
      }

      var typeName = parent.GetAttribute("typeName");
      var methodName = parent.GetAttribute("methodName");
      var isIgnored = bool.Parse(parent.GetAttribute("isIgnored"));

      return ContextSpecificationFactory.GetOrCreateContextSpecification(provider,
#if RESHARPER_61
                manager, psiModuleManager, cacheManager,
#endif
                project, context, ProjectModelElementEnvoy.Create(project), new ClrTypeName(typeName), methodName, EmptyArray<string>.Instance, isIgnored);
    }
 	protected GallioTestElementBase(IUnitTestRunnerProvider provider, string id, IUnitTestElement parent)
     {
 		Provider = provider;
 		Id = id;
 		Parent = parent;
 		children = new List<IUnitTestElement>();
     }
 public bool Equals(IUnitTestElement other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     if (!(other is SilverlightUnitTestElement)) return false;
     return Equals(other.Id, Id);
 }
            public void SerializeElement(XmlElement parent, IUnitTestElement element)
            {
                parent.SetAttribute("type", element.GetType().Name);

                var writableUnitTestElement = (ISerializableUnitTestElement)element;
                writableUnitTestElement.WriteToXml(parent);
            }
Пример #12
0
 public RuntimeEnvironment GetRuntimeEnvironment(
     IUnitTestElement element,
     RuntimeEnvironment projectRuntimeEnvironment,
     TargetPlatform targetPlatform,
     IUnitTestLaunch launch)
 {
     return new RuntimeEnvironment { PlatformType = PlatformType.x86, PlatformVersion = PlatformVersion.v4_0 };
 }
Пример #13
0
 public void SerializeElement(XmlElement parent, IUnitTestElement element)
 {
   var e = element as ISerializableElement;
   if (e != null)
   {
     e.WriteToXml(parent);
     parent.SetAttribute("elementType", e.GetType().Name);
   }
 }
 public void Present(IUnitTestElement element, IPresentableItem item, TreeModelNode node, PresentationState state)
 {
     // We only want to customise how class elements are displayed. If the
     // parent node isn't a namespace, and isn't the namespace of the class,
     // display the class as namespace qualified
     if (!(element is XunitTestClassElement))
         return;
     treePresenter.UpdateItem(element, node, item, state);
 }
        public IUnitTestElement DeserializeElement(XmlElement parent, IUnitTestElement parentElement)
        {
            if (SilverlightUnitTestElement.CanDeserialize(parent))
            {
                return SilverlightUnitTestElement.Deserialize(parent, this);
            }

            throw new ArgumentOutOfRangeException();
        }
        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);
        }
 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);
 }
        public TestMethodElement(TestProvider provider, IUnitTestElement parent, ProjectModelElementEnvoy projectModelElementEnvoy,
            DeclaredElementProvider declaredElementProvider, string id, IClrTypeName typeName, string methodName, string assemblyLocation, bool isParameterized)
            : base(provider, typeName, assemblyLocation, parent, id, projectModelElementEnvoy)
        {
            this.declaredElementProvider = declaredElementProvider;
            this.methodName = methodName;
            IsParameterized = isParameterized;

            ShortName = methodName;
            presentation = string.Format("{0}.{1}", typeName.ShortName, methodName);
        }
        public IUnitTestElement DeserializeElement(XmlElement parent, IUnitTestElement parentElement)
        {
            if (!parent.HasAttribute("type"))
                throw new ArgumentException("Element is not Fixie");

            Func<XmlElement, IUnitTestElement, ISolution, UnitTestElementFactory, IUnitTestElement> func;
            if (DeserialiseMap.TryGetValue(parent.GetAttribute("type"), out func))
                return func(parent, parentElement, solution, unitTestElementFactory);

            throw new ArgumentException("Element is not Fixie");
        }
 public bool IsElementOfKind(IUnitTestElement element, UnitTestElementKind elementKind)
 {
     switch (elementKind)
     {
         case UnitTestElementKind.Test:
             return element is SpecificationElement;
         case UnitTestElementKind.TestContainer:
             return element is SpecificationContainerElement;
         default:
             return false;
     }
 }
 protected XunitBaseElement(IUnitTestProvider provider, IUnitTestElement parent, string id,
                            ProjectModelElementEnvoy projectModelElementEnvoy,
                            IEnumerable<UnitTestElementCategory> categories)
 {
     Provider = provider;
     Parent = parent;
     Id = id;
     this.projectModelElementEnvoy = projectModelElementEnvoy;
     Children = new List<IUnitTestElement>();
     SetCategories(categories);
     ExplicitReason = string.Empty;
     SetState(UnitTestElementState.Valid);
 }
        public IUnitTestElement DeserializeElement(XmlElement parent, string id, IUnitTestElement parentElement, IProject project)
        {
            if (!parent.HasAttribute("type"))
                throw new ArgumentException("Element is not xunit");

            ReadFromXmlFunc func;
            if (DeserialiseMap.TryGetValue(parent.GetAttribute("type"), out func))
            {
                var unitTestElementFactory = new UnitTestElementFactory(services, null);
                return func(parent, parentElement, project, id, unitTestElementFactory);
            }

            throw new ArgumentException("Element is not xunit");
        }
        protected BaseElement(TestProvider provider, IClrTypeName typeName, string assemblyLocation, IUnitTestElement parent, string id, ProjectModelElementEnvoy projectModelElementEnvoy)
        {
            this.provider = provider;
            this.id = id;
            this.projectModelElementEnvoy = projectModelElementEnvoy;

            TypeName = typeName;
            AssemblyLocation = assemblyLocation;
            Parent = parent;

            Children = new List<IUnitTestElement>();

            SetState(UnitTestElementState.Valid);
        }
 public IUnitTestElement DeserializeElement(XmlElement xml, IUnitTestElement parent)
 {
     if (!xml.HasAttribute("type"))
         throw new ArgumentException(@"Element is not Xunit", "xml");
     switch (xml.GetAttribute("type"))
     {
         case "XunitTestClassElement":
             return XunitTestClassElement.ReadFromXml(xml, parent, factory, solution);
         case "XunitTestMethodElement":
             return XunitTestMethodElement.ReadFromXml(xml, parent, factory, solution);
         default:
             throw new ArgumentException(@"Element is not Xunit", "xml");
     }
 }
    public IUnitTestElement DeserializeElement(XmlElement parent, IUnitTestElement parentElement)
    {
      var typeName = parent.GetAttribute("elemenType");

      if (Equals(typeName, "ContextElement"))
        return ContextElement.ReadFromXml(parent, parentElement, _provider, _solution, _manager, _psiModuleManager, _cacheManager);
      if (Equals(typeName, "BehaviorElement"))
        return BehaviorElement.ReadFromXml(parent, parentElement, _provider, _solution, _manager, _psiModuleManager, _cacheManager);
      if (Equals(typeName, "BehaviorSpecificationElement"))
        return BehaviorSpecificationElement.ReadFromXml(parent, parentElement, _provider, _solution, _manager, _psiModuleManager, _cacheManager);
      if (Equals(typeName, "ContextSpecificationElement"))
        return ContextSpecificationElement.ReadFromXml(parent, parentElement, _provider, _solution, _manager, _psiModuleManager, _cacheManager);

      return null;
    }
    public IUnitTestElement DeserializeElement(XmlElement parent, IUnitTestElement parentElement)
    {
      var typeName = parent.GetAttribute("elemenType");

      if (Equals(typeName, "ContextElement"))
        return ContextElement.ReadFromXml(parent, parentElement, this);
      if (Equals(typeName, "BehaviorElement"))
        return BehaviorElement.ReadFromXml(parent, parentElement, this);
      if (Equals(typeName, "BehaviorSpecificationElement"))
        return BehaviorSpecificationElement.ReadFromXml(parent, parentElement, this);
      if (Equals(typeName, "ContextSpecificationElement"))
        return ContextSpecificationElement.ReadFromXml(parent, parentElement, this);

      return null;
    }
        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");
        }
Пример #28
0
 public int CompareUnitTestElements(IUnitTestElement x, IUnitTestElement y)
 {
     if (!(x is JasmineSuiteElement) || !(y is JasmineSuiteElement))
     {
         return _comparer.Compare(x, y);
     }
     if (x.Id.StartsWith(y.Id))
     {
         return 1;
     }
     if (y.Id.StartsWith(x.Id))
     {
         return -1;
     }
     return string.Compare(x.ShortName, y.ShortName, StringComparison.Ordinal);
 }
    public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider)
    {
      var projectId = parent.GetAttribute("projectId");
      var project = ProjectUtil.FindProjectElementByPersistentID(provider.Solution, projectId) as IProject;
      if (project == null)
        return null;

      var context = parentElement as ContextElement;
      if (context == null)
        return null;

      var typeName = parent.GetAttribute("typeName");
      var methodName = parent.GetAttribute("methodName");
      var isIgnored = bool.Parse(parent.GetAttribute("isIgnored"));

      return new ContextSpecificationElement(provider, context, ProjectModelElementEnvoy.Create(project), typeName, methodName, Enumerable.Empty<string>(), isIgnored);
    }
Пример #30
0
 public int CompareUnitTestElements(IUnitTestElement x, IUnitTestElement y)
 {
     return(Comparer.Compare(x, y));
 }
        public override string GetPresentation(IUnitTestElement parent = null)
        {
            var e = _examples.First();

            return(e.ColumnNamesToString());
        }
Пример #32
0
        public bool IsElementOfKind(IUnitTestElement element, UnitTestElementKind elementKind)
        {
            var testElement = element as ITestElement;

            return(testElement != null && testElement.ElementKind == elementKind);
        }
Пример #33
0
 public override string GetPresentation(IUnitTestElement parent = null)
 {
     return(Scenario);
 }
Пример #34
0
 public string GetPresentation(IUnitTestElement parent = null, bool full = false)
 {
     throw new NotImplementedException();
 }
Пример #35
0
 public string GetPresentation(IUnitTestElement parent = null, bool full = false) => _text;
 public override bool Equals(IUnitTestElement other)
 {
     return(Equals(other as XunitInheritedTestMethodContainerElement));
 }
Пример #37
0
 public bool IsElementOfKind(IUnitTestElement element, UnitTestElementKind elementKind)
 {
     throw new NotImplementedException();
 }
Пример #38
0
 public bool Equals(IUnitTestElement other)
 {
     return(ReferenceEquals(this, other) || Id.Equals(other.Id));
 }
Пример #39
0
 public override bool Equals(IUnitTestElement other)
 {
     return(Equals(other as XunitTestMethodElement));
 }
 public override bool Equals(IUnitTestElement other)
 {
     return(Equals(other as NBehaveExampleParentTestElement));
 }
Пример #41
0
 public string GetPresentation(IUnitTestElement parent = null)
 {
     return(GetPresentation());
 }
Пример #42
0
 public override IUnitTestRunStrategy GetRunStrategy(IUnitTestElement element)
 {
     return(IsUnityUnitTestStrategy() ? myUnityEditorStrategy : base.GetRunStrategy(element));
 }
Пример #43
0
 private void CreateAndAppendChildren(IUnitTestElement testElement, ITestEntity testEntity)
 {
     testEntity.TestEntities.Select(GetOrCreateChildTest).ForEach(x => x.Parent = testElement);
 }
 public void OnUnitTestElement(IUnitTestElement element)
 {
     inner.OnUnitTestElement(element);
 }
Пример #45
0
 public override string GetPresentation(IUnitTestElement parent, bool full)
 {
     return(full ? Id.Id : ShortName);
 }
Пример #46
0
 public string GetPresentation(IUnitTestElement parent = null)
Пример #47
0
 public string GetPresentation(IUnitTestElement parent = null, bool full = false)
 {
     return(_text);
 }
Пример #48
0
 protected override string GetIdString(IUnitTestElement element)
 {
     return(string.Format("{0}::{1}::{2}", element.Id.Provider.ID, element.Id.Project.GetPersistentID(), element.Id.Id));
 }
 public override string GetPresentation(IUnitTestElement parent)
 {
     return(methodName);
 }
Пример #50
0
 public override bool Equals(IUnitTestElement other)
 {
     return(Equals(other as NBehaveScenarioTestElement));
 }
 public int CompareUnitTestElements(IUnitTestElement x, IUnitTestElement y)
 {
     return(String.CompareOrdinal(x.ShortName, y.ShortName));
 }
Пример #52
0
 public int CompareUnitTestElements(IUnitTestElement x, IUnitTestElement y)
 {
     throw new NotImplementedException();
 }
Пример #53
0
 public bool Equals(IUnitTestElement other)
 {
     return(Equals(other as GallioTestElement));
 }
Пример #54
0
 public bool SupportsResultEventsForParentOf(IUnitTestElement element)
 {
     throw new NotImplementedException();
 }
Пример #55
0
 public override string GetPresentation(IUnitTestElement parent = null)
 {
     return(ShortName);
 }
Пример #56
0
 protected abstract string GetIdString(IUnitTestElement element);
Пример #57
0
 public override bool Equals(IUnitTestElement other)
 {
     return(Equals(other as NBehaveBackgroundTestElement));
 }
 public override IUnitTestRunStrategy GetRunStrategy(IUnitTestElement element)
 {
     return(IsUnityUnitTestStrategy(myUnitySolutionTracker, myRdUnityModel, myEditorProtocol) ? myUnityEditorStrategy : base.GetRunStrategy(element));
 }
Пример #59
0
 public string GetPresentation(IUnitTestElement unitTestElement)
 {
     return(GetPresentation());
 }
            public IUnitTestElement DeserializeElement(XmlElement parent, IUnitTestElement parentElement)
            {
                if (!parent.HasAttribute("type"))
                    throw new ArgumentException("Element has no Type attribute");

                ReadFromXmlFunc func;
                if (DeserialiseMap.TryGetValue(parent.GetAttribute("type"), out func))
                    return func(parent, parentElement, _solution, _unitTestElementFactory);

                throw new ArgumentException("Element has no Type attribute");
            }