Esempio n. 1
0
        protected override MspecBehaviorSpecificationTestElement?ToElement(MspecBehaviorSpecificationRemoteTask task, ITestRunnerDiscoveryContext context, IUnitTestElementObserver observer)
        {
            if (task.ParentId == null)
            {
                context.Logger.Warn($"Cannot create element for MspecBehaviorSpecificationTestElement '{task.TestId}': ParentId is missing");

                return(null);
            }

            var specificationElement = observer.GetElementById <MspecSpecificationTestElement>(task.ParentId);

            if (specificationElement == null)
            {
                context.Logger.Warn("Cannot create element for MspecBehaviorSpecificationTestElement '" + task.TestId + "': Specification is missing");

                return(null);
            }

            var factory = GetFactory(context);

            return(factory.GetOrCreateBehaviorSpecification(
                       specificationElement,
                       task.FieldName !,
                       task.IgnoreReason));
        }
        protected override MspecSpecificationTestElement?ToElement(MspecSpecificationRemoteTask task, ITestRunnerDiscoveryContext context, IUnitTestElementObserver observer)
        {
            if (task.ContextTypeName == null)
            {
                context.Logger.Warn($"Cannot create element for MspecSpecificationTestElement '{task.TestId}': ContextTypeName is missing");

                return(null);
            }

            var factory = GetFactory(context);

            var contextElement = observer.GetElementById <MspecContextTestElement>(task.ContextTypeName);

            if (contextElement == null)
            {
                context.Logger.Warn($"Cannot create element for MspecSpecificationTestElement '{task.TestId}': Context is missing");

                return(null);
            }

            return(factory.GetOrCreateSpecification(
                       contextElement,
                       task.FieldName !,
                       task.BehaviorType,
                       task.IgnoreReason));
        }
Esempio n. 3
0
        protected override MspecContextTestElement ToElement(MspecContextRemoteTask task, ITestRunnerDiscoveryContext context, IUnitTestElementObserver observer)
        {
            var factory = GetFactory(context);

            return(factory.GetOrCreateContext(
                       new ClrTypeName(task.ContextTypeName),
                       task.Subject,
                       task.Tags,
                       task.IgnoreReason));
        }
Esempio n. 4
0
 protected UnitTestElementFactory GetFactory(ITestRunnerDiscoveryContext context)
 {
     return(context.GetOrCreateDataUnderLock(
                MspecElementMappingKeys.ElementFactoryKey, static () => new UnitTestElementFactory()));
 }
Esempio n. 5
0
 public IUnitTestElement?GetElement(TTask task, ITestRunnerDiscoveryContext context, IUnitTestElementObserver observer)
 {
     return(ToElement(task, context, observer));
 }
Esempio n. 6
0
 protected abstract TElement?ToElement(TTask task, ITestRunnerDiscoveryContext context, IUnitTestElementObserver observer);
Esempio n. 7
0
 public Task <ITestRunnerDiscoveryAgent> GetDiscoveryAgent(ITestRunnerDiscoveryContext context, CancellationToken ct)
 {
     throw new NotSupportedException();
 }