/// <summary> /// Register another available unit test provider for the unit test system. /// </summary> /// <param name="provider">A unit test provider.</param> public static void RegisterUnitTestProvider(IUnitTestProvider provider) { if (!UnitTestProviders.Providers.Contains(provider)) { UnitTestProviders.Providers.Add(provider); } }
public AssemblyDispatcher(UnitTestHarness testHarness, IUnitTestProvider provider, IAssembly testAssembly) : base(testHarness, provider) { _assembly = testAssembly; _testClasses = new TestWorkItemDispatcher(); _classInstances = new TestClassInstanceCollection(); }
public static XunitTestTheoryElement CreateTestTheory(IUnitTestProvider provider, IProject project, XunitTestMethodElement methodElement, string name) { var shortName = GetTestTheoryShortName(name, methodElement); var id = GetTestTheoryId(methodElement, shortName); return(new XunitTestTheoryElement(provider, methodElement, new ProjectModelElementEnvoy(project), id, shortName)); }
public ContextFactory(IUnitTestProvider provider, IProjectModelElement project, string assemblyPath, ContextCache cache) { _provider = provider; _cache = cache; _project = project; _assemblyPath = assemblyPath; }
public static UnitTestElementId CreateId(IUnitTestProvider provider, ContextElement contextElement, string fieldName) { var result = new[] { contextElement.Id, fieldName }; var id = result.Where(s => !string.IsNullOrEmpty(s)).AggregateString("."); return(new UnitTestElementId(provider, new PersistentProjectId(contextElement.GetProject()), id)); }
/// <summary> /// Create a new assembly manager, takes in the harness, provider /// reference and actual IAssembly object. /// </summary> /// <param name="runFilter">The test run filter object.</param> /// <param name="testHarness">Harness object.</param> /// <param name="provider">The unit test metadata provider.</param> /// <param name="testAssembly">The test assembly metadata object.</param> public AssemblyManager(TestRunFilter runFilter, UnitTestHarness testHarness, IUnitTestProvider provider, IAssembly testAssembly) : base(testHarness, provider) { _filter = runFilter; _assembly = testAssembly; _testClasses = new CompositeWorkItem(); ClassInstances = new TestClassInstanceDictionary(); }
protected StorEvilUnitTestElement(IUnitTestProvider provider, UnitTestElement parent, IProject project, string title) : base(provider, parent) { Project = project; _title = title; }
/// <summary> /// A container type that handles an entire test class throughout the /// test run. /// </summary> /// <param name="filter">Test run filter object.</param> /// <param name="testHarness">The unit test harness.</param> /// <param name="testClass">The test class metadata interface.</param> /// <param name="instance">The object instance.</param> /// <param name="provider">The unit test provider.</param> public TestClassManager(TestRunFilter filter, UnitTestHarness testHarness, ITestClass testClass, object instance, IUnitTestProvider provider) : base(testHarness, provider) { _filter = filter; _testClass = testClass; _testExecutionQueue = new CompositeWorkItem(); _instance = instance; }
public SilverlightUnitTestElement(IUnitTestProvider provider, IUnitTestRunStrategy runStrategy) { this.runStrategy = runStrategy; Id = Guid.NewGuid().ToString(); Provider = provider; Children = new List <IUnitTestElement>(); }
public TestUnitTestElement(IUnitTestProvider provider, GallioTestElement parent, string testId, string testName, string kind, bool isTestCase, IProject project, IDeclaredElementResolver declaredElementResolver, string assemblyPath, string typeName, string namespaceName) : base(provider, parent, testId, testName, kind, isTestCase, project, declaredElementResolver, assemblyPath, typeName, namespaceName) { }
public static void EnsureSilverlightPlatformSupport(this IUnitTestLaunch launch, ref IUnitTestRun run, IUnitTestProvider provider, ITaskRunnerHostController hostController) { foreach (var sequence in run.GetRootTasks().ToArray()) { ConvertToSilverlightSequenceIfNecessary(sequence, ref run, launch, provider, hostController); } }
protected Element(IUnitTestProvider provider, UnitTestElement parent, ProjectModelElementEnvoy projectEnvoy, string declaringTypeName, bool isIgnored) : base(provider, parent) { if (projectEnvoy == null && !Shell.Instance.IsTestShell) { throw new ArgumentNullException("projectEnvoy"); } if (declaringTypeName == null) { throw new ArgumentNullException("declaringTypeName"); } _projectEnvoy = projectEnvoy; _declaringTypeName = declaringTypeName; if (isIgnored) { SetExplicit("Ignored"); } }
public FileExplorer(IUnitTestProvider provider, UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted) { if (file == null) { throw new ArgumentNullException("file"); } if (provider == null) { throw new ArgumentNullException("provider"); } _consumer = consumer; _file = file; _interrupted = interrupted; IProject project = file.ProjectFile.GetProject(); string assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath; var cache = new ContextCache(); var contextFactory = new ContextFactory(provider, project, assemblyPath, cache); var contextSpecificationFactory = new ContextSpecificationFactory(provider, project, cache); var behaviorFactory = new BehaviorFactory(provider, project, cache); var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project); _elementHandlers = new List <IElementHandler> { new ContextElementHandler(contextFactory), new ContextSpecificationElementHandler(contextSpecificationFactory), new BehaviorElementHandler(behaviorFactory, behaviorSpecificationFactory) }; }
public ContextFactory(IUnitTestProvider provider, ProjectModelElementEnvoy projectEnvoy, string assemblyPath, ContextCache cache) { _provider = provider; _cache = cache; _projectEnvoy = projectEnvoy; _assemblyPath = assemblyPath; }
public SilverlightUnitTestElement(IUnitTestProvider provider, IUnitTestRunStrategy runStrategy) { this.runStrategy = runStrategy; Id = Guid.NewGuid().ToString(); Provider = provider; Children = new List<IUnitTestElement>(); }
public FileExplorer(IUnitTestProvider provider, UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted) { if (file == null) { throw new ArgumentNullException("file"); } if (provider == null) { throw new ArgumentNullException("provider"); } _consumer = consumer; _file = file; _interrupted = interrupted; IProject project = file.ProjectFile.GetProject(); string assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath; var contextFactory = new ContextFactory(provider, project, assemblyPath); var contextSpecificationFactory = new ContextSpecificationFactory(provider, project); var behaviorFactory = new BehaviorFactory(provider, project); var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project); _elementHandlers = new List<IElementHandler> { new ContextElementHandler(contextFactory), new ContextSpecificationElementHandler(contextSpecificationFactory), new BehaviorElementHandler(behaviorFactory, behaviorSpecificationFactory) }; }
public CSUnitTestElement(IUnitTestProvider provider, CSUnitTestFixtureElement fixture, IProject project, string declaringTypeName, string methodName, int order) : base(provider, fixture, project, declaringTypeName) { myFixture = fixture; myOrder = order; myMethodName = methodName; }
protected TestElementBase(ITestIdentity identity, IList<Task> tasks) { _identity = identity; _tasks = tasks; _unitTestProvider = identity.ElementId.Provider; _children = new HashSet<IUnitTestElement>(); }
public BaseTestAssembly(IUnitTestProvider provider, UnitTestHarness testHarness, Assembly assembly) { this.provider = provider; this.testHarness = testHarness; this.assembly = assembly; this.init = new LazyAssemblyMethodInfo(this.assembly, typeof(AssemblyInitializeAttribute)); this.cleanup = new LazyAssemblyMethodInfo(this.assembly, typeof(AssemblyCleanupAttribute)); }
protected TestElementBase(ITestIdentity identity, IList <Task> tasks) { _identity = identity; _tasks = tasks; _unitTestProvider = identity.Provider; _children = new HashSet <IUnitTestElement>(); }
public static GallioTestElement CreateFromTest(TestData test, ICodeElementInfo codeElement, IUnitTestProvider provider, GallioTestElement parent) { if (test == null) throw new ArgumentNullException("test"); // The idea here is to generate a test element object that does not retain any direct // references to the code element info and other heavyweight objects. A test element may // survive in memory for quite a long time so we don't want it holding on to all sorts of // irrelevant stuff. Basically we flatten out the test to just those properties that we // need to keep. var element = new GallioTestElement(provider, parent, test.Id, test.Name, test.Metadata.GetValue(MetadataKeys.TestKind) ?? "Unknown", test.IsTestCase, ReSharperReflectionPolicy.GetProject(codeElement), ReSharperReflectionPolicy.GetDeclaredElementResolver(codeElement), GetAssemblyPath(codeElement), GetTypeName(codeElement), GetNamespaceName(codeElement)); var categories = test.Metadata[MetadataKeys.Category]; if (categories.Count != 0) element.Categories = UnitTestElementCategory.Create(categories); var reason = test.Metadata.GetValue(MetadataKeys.IgnoreReason); if (reason != null) element.ExplicitReason = reason; return element; }
/// <summary> /// Constructor for a test method manager, which handles executing a single test method /// for a unit test provider. /// </summary> /// <param name="testHarness">The unit test harness object.</param> /// <param name="testClass">The test class metadata object.</param> /// <param name="testMethod">The test method metadata object.</param> /// <param name="instance">The test class instance.</param> /// <param name="provider">The unit test provider.</param> public TestMethodManager(UnitTestHarness testHarness, ITestClass testClass, ITestMethod testMethod, object instance, IUnitTestProvider provider) : base(testHarness, provider) { _testClass = testClass; _testMethod = testMethod; _instance = instance; }
public XunitTestFakeElement(IUnitTestProvider provider, IProject project, IClrTypeName typeName, string methodName) { Provider = provider; myProject = project; TypeName = typeName; myMethodName = methodName; State = UnitTestElementState.Fake; }
public UnitTestFrameworkAssembly(IUnitTestProvider provider, UnitTestHarness unitTestHarness, Assembly assembly) { this.provider = provider; harness = unitTestHarness; this.assembly = assembly; lazyMethodInfo = new LazyAssemblyMethodInfo(this.assembly, ProviderAttributes.AssemblyInitialize); cleanup = new LazyAssemblyMethodInfo(this.assembly, ProviderAttributes.AssemblyCleanup); }
/// <summary> /// Creates a new unit test assembly wrapper. /// </summary> /// <param name="provider">Unit test metadata provider.</param> /// <param name="unitTestHarness">A reference to the unit test harness.</param> /// <param name="assembly">Assembly reflection object.</param> public UnitTestFrameworkAssembly(IUnitTestProvider provider, UnitTestHarness unitTestHarness, Assembly assembly) { _provider = provider; _harness = unitTestHarness; _assembly = assembly; _init = new LazyAssemblyMethodInfo(_assembly, ProviderAttributes.AssemblyInitialize); _cleanup = new LazyAssemblyMethodInfo(_assembly, ProviderAttributes.AssemblyCleanup); }
public SpecflowTestExplorer( SpecflowUnitTestProvider unitTestProvider, IUnitTestElementRepository unitTestElementRepository ) { Provider = unitTestProvider; _unitTestElementRepository = unitTestElementRepository; }
public MetadataExplorer(IUnitTestProvider provider, ISolution solution, IProject project, UnitTestElementConsumer consumer) { testProvider = provider; this.consumer = consumer; this.project = project; this.solution = solution; projectModel = new ProjectModelElementEnvoy(this.project); }
/// <summary> /// Creates a new unit test assembly wrapper. /// </summary> /// <param name="provider">Unit test metadata provider.</param> /// <param name="unitTestHarness">A reference to the unit test harness.</param> /// <param name="assembly">Assembly reflection object.</param> public BddTestAssembly(IUnitTestProvider provider, UnitTestHarness unitTestHarness, Assembly assembly) { _provider = provider; _harness = unitTestHarness; _assembly = assembly; _init = new LazyAssemblyMethodInfo(_assembly, typeof(AssemblyInitializeAttribute)); _cleanup = new LazyAssemblyMethodInfo(_assembly, typeof(AssemblyCleanupAttribute)); }
public TestClassDispatcher( UnitTestHarness testHarness, ITestClass testClass, object instance, IUnitTestProvider provider) : base(testHarness, provider) { _testClass = testClass; _testExecutionQueue = new TestWorkItemDispatcher(); _instance = instance; }
public SpecElement(IUnitTestProvider provider, ISpec spec, IProject project) : base(provider, spec, project, null) { _spec = spec; _project = project; var type = _spec.GetType(); Id = type.FullName; AssemblyLocation = type.Assembly.Location; }
public XunitTestTheoryElement(IUnitTestProvider provider, XunitTestMethodElement methodElement, ProjectModelElementEnvoy projectModelElementEnvoy, string id, string shortName) : base(provider, methodElement, id, projectModelElementEnvoy, new JetHashSet <string>()) { SetState(UnitTestElementState.Dynamic); ShortName = shortName; ExplicitReason = string.Empty; }
public ConsumerAdapter(IUnitTestProvider provider, UnitTestElementConsumer consumer) { this.provider = provider; this.consumer = consumer; messageConsumer = new MessageConsumer() .Handle <TestDiscoveredMessage>(HandleTestDiscoveredMessage) .Handle <AnnotationDiscoveredMessage>(HandleAnnotationDiscoveredMessage); }
public XunitTestTheoryElement(IUnitTestProvider provider, XunitTestMethodElement methodElement, ProjectModelElementEnvoy projectModelElementEnvoy, string id, string shortName, IEnumerable <UnitTestElementCategory> categories) : base(provider, methodElement, id, projectModelElementEnvoy, categories) { SetState(UnitTestElementState.Dynamic); ShortName = shortName; ExplicitReason = string.Empty; }
protected FieldElement(IUnitTestProvider provider, UnitTestElement parent, IProjectModelElement project, string declaringTypeName, string fieldName, bool isIgnored) : base(provider, parent, project, declaringTypeName, isIgnored || parent.IsExplicit) { _fieldName = fieldName; }
protected UnitTestFrameworkAssemblyBase(IUnitTestProvider provider, object unitTestHarness, Assembly assembly) { Provider = provider; #if Feb2011 TestHarness = unitTestHarness as UnitTestHarness; #else TestHarness = unitTestHarness as ITestHarness; #endif Assembly = assembly; }
public SilverlightXunitTestFileExplorer(UnitTestProviders providers) { provider = providers.GetProvider(ProviderId); if (provider == null) { xUnitInstalled = false; provider = providers.GetProvider(SilverlightUnitTestProvider.RunnerId); } }
protected UnitTestFrameworkAssemblyBase(IUnitTestProvider provider, object unitTestHarness, Assembly assembly) { Provider = provider; #if MSTest2010March || MSTest2010April || MSTest2010May || MSTest2009July || MSTest2009October || MSTest2009November TestHarness = unitTestHarness as ITestHarness; #else TestHarness = unitTestHarness as UnitTestHarness; #endif Assembly = assembly; }
public SilverlightXunitTestFileExplorer(ISolution solution) { provider = UnitTestManager.GetInstance(solution).GetProvider(ProviderId); if (provider == null) { xUnitInstalled = false; provider = UnitTestManager.GetInstance(solution).GetProvider(SilverlightUnitTestProvider.RunnerId); } }
public XunitInheritedTestMethodContainerElement(IUnitTestProvider provider, ProjectModelElementEnvoy projectModelElementEnvoy, string id, IClrTypeName typeName, string methodName) : base(provider, null, id, projectModelElementEnvoy, new JetHashSet <string>()) { TypeName = typeName; this.methodName = methodName; ShortName = methodName; SetState(UnitTestElementState.Fake); ExplicitReason = null; }
protected UnitTestFrameworkAssemblyBase(IUnitTestProvider provider, object unitTestHarness, Assembly assembly) { Provider = provider; #if March2010 || April2010 || May2010 || July2009 || October2009 || November2009 TestHarness = unitTestHarness as ITestHarness; #else TestHarness = unitTestHarness as UnitTestHarness; #endif Assembly = assembly; }
protected FieldElement(IUnitTestProvider provider, UnitTestElement parent, ProjectModelElementEnvoy projectEnvoy, string declaringTypeName, string fieldName, bool isIgnored) : base(provider, parent, projectEnvoy, declaringTypeName, isIgnored || parent.IsExplicit) { _fieldName = fieldName; }
/// <summary> /// Initializes a new unit test work item container. /// </summary> /// <param name="testHarness">The unit test harness.</param> /// <param name="unitTestProvider">The unit test metadata provider.</param> protected UnitTestCompositeWorkItem(UnitTestHarness testHarness, IUnitTestProvider unitTestProvider) : base() { _provider = unitTestProvider; TestHarness = testHarness; if (TestHarness == null) { throw new InvalidOperationException(Properties.UnitTestMessage.UnitTestCompositeWorkItem_ctor_NoTestHarness); } }
/// <summary> /// Initializes the provider. /// </summary> public Shim(IUnitTestProvider provider) { this.provider = provider; testFrameworkManager = RuntimeAccessor.ServiceLocator.Resolve <ITestFrameworkManager>(); presenter = new GallioTestPresenter(); logger = new FacadeLoggerWrapper(new AdapterFacadeLogger()); RuntimeAccessor.Instance.AddLogListener(logger); }
/// <summary> /// Call this method from the Loaded event in MainPage /// </summary> /// <param name="testProvider">Optional test provider implementation. If omitted the default MsTest provider will be used</param> public static void StartTestRunner(this PhoneApplicationPage mainPage, IUnitTestProvider testProvider = null) { if (testProvider != null) { UnitTestSystem.RegisterUnitTestProvider(testProvider); } var testPage = (IMobileTestPage)UnitTestSystem.CreateTestPage(); mainPage.BackKeyPress += (x, xe) => xe.Cancel = testPage.NavigateBack(); mainPage.Content = testPage as UIElement; }