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)); }
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)); }
protected UnitTestElementFactory GetFactory(ITestRunnerDiscoveryContext context) { return(context.GetOrCreateDataUnderLock( MspecElementMappingKeys.ElementFactoryKey, static () => new UnitTestElementFactory())); }
public IUnitTestElement?GetElement(TTask task, ITestRunnerDiscoveryContext context, IUnitTestElementObserver observer) { return(ToElement(task, context, observer)); }
protected abstract TElement?ToElement(TTask task, ITestRunnerDiscoveryContext context, IUnitTestElementObserver observer);
public Task <ITestRunnerDiscoveryAgent> GetDiscoveryAgent(ITestRunnerDiscoveryContext context, CancellationToken ct) { throw new NotSupportedException(); }