public static UnitTestElementId CreateId(IUnitTestElementIdFactory elementIdFactory, IUnitTestProvider provider, BehaviorElement behaviorElement, string fieldName)
        {
            var result = new[] { behaviorElement.Id, fieldName };
            var id     = result.Where(s => !string.IsNullOrEmpty(s)).AggregateString(".");

            return(elementIdFactory.Create(provider, behaviorElement.GetProject(), id));
        }
        private IUnitTestElement GetOrCreateAndUpdateElement(
            ITestEntity testEntity,
            Func <ITestIdentity, ITestElement> factory)
        {
            var elementId = _unitTestElementIdFactory.Create(_testProvider, testEntity.Project, testEntity.Identity.Absolute);
            var identity  = new TestIdentity(elementId, testEntity.Identity);
            var element   = _unitTestElementManager.GetElementByIdentity(identity) ?? factory(identity);

            element.Update(testEntity.Text, explicitReason: null, categories: testEntity.Categories.Select(x => _unitTestElementCategoryFactory.Create(x)));

            return(element);
        }
Exemple #3
0
        public static UnitTestElementId CreateId(IUnitTestElementIdFactory elementIdFactory, IUnitTestProvider provider, IProject project, string subject, string typeName, IEnumerable <string> tags)
        {
            string tagsAsString = null;

            if (tags != null)
            {
                tagsAsString = tags.AggregateString("", "|", (builder, tag) => builder.Append(tag));
            }
            var result = new[] { subject, typeName, tagsAsString };
            var id     = result.Where(s => !string.IsNullOrEmpty(s)).AggregateString(".");

            return(elementIdFactory.Create(provider, project, id));
        }
Exemple #4
0
        public UnityTestElement GetOrCreateTest(string id, [NotNull] IProject project, TargetFrameworkId targetFrameworkId, IClrTypeName typeName, string methodName)
        {
            lock (myLock)
            {
                var uid     = myUnitTestElementIdFactory.Create(myUnitTestProvider, project, targetFrameworkId, id);
                var element = GetElementById <UnityTestElement>(uid);
                if (element == null)
                {
                    myElements[uid] = element = new UnityTestElement(project, typeName, uid, myServiceProvider, methodName);
                }

                return(element);
            }
        }
Exemple #5
0
        private IUnitTestElement GetOrCreateAndUpdateElement(
            ITestEntity testEntity,
            Func <ITestIdentity, ITestElement> factory)
        {
            var elementId = _unitTestElementIdFactory.Create(
                _testProvider.ID,
                testEntity.Project.GetPersistentID(),
                // TODO: TargetFrameworkId
                TargetFrameworkId.Default,
                testEntity.Identity.Absolute);
            var identity = new TestIdentity(elementId, testEntity.Identity);
            var element  = _unitTestElementManager.GetElementById(identity.ElementId) as ITestElement ?? factory(identity);

            element.Update(testEntity.Text, explicitReason: null, categories: testEntity.Categories.Select(x => _unitTestElementCategoryFactory.Create(x)));

            return(element);
        }
Exemple #6
0
 public UnitTestElementId CreateId(IProject project, TargetFrameworkId targetFrameworkId, string id)
 {
     return(_elementIdFactory.Create(_provider, project, targetFrameworkId, id));
 }
 public static UnitTestElementId CreateId(IUnitTestElementIdFactory elementIdFactory, IUnitTestProvider provider, BehaviorElement behaviorElement, string fieldName)
 {
     var result = new[] { behaviorElement.Id, fieldName };
     var id = result.Where(s => !string.IsNullOrEmpty(s)).AggregateString(".");
     return elementIdFactory.Create(provider, new PersistentProjectId(behaviorElement.GetProject()), id);
 }
Exemple #8
0
 public TestIdentity(ITestProvider provider, IProject project, IIdentity wrappedIdentity, IUnitTestElementIdFactory unitTestElementIdFactory)
     : this(provider, wrappedIdentity)
 {
     _elementId = unitTestElementIdFactory.Create(_provider, new PersistentProjectId(project), Absolute);
 }
Exemple #9
0
 public UnitTestElementId CreateId(IProject project, string id)
 {
     return(elementIdFactory.Create(Provider, project, id));
 }
Exemple #10
0
 public TestIdentity(ITestProvider provider, IProject project, IIdentity wrappedIdentity, IUnitTestElementIdFactory unitTestElementIdFactory)
     : this(provider, wrappedIdentity)
 {
     _elementId = unitTestElementIdFactory.Create(_provider, new PersistentProjectId(project), Absolute);
 }