/// <summary> /// Resolve full name for this test cycle. /// </summary> /// <param name="type"> From which this test cycle is constructed. </param> /// <param name="scope"> Scope of this test cycle. </param> /// <returns> Full name of this test cycle. </returns> internal string ResolveTestCycleFullName(Type type, TestCycleScope scope) { string fullName = string.Empty; switch (scope) { case TestCycleScope.AppDomain: fullName = Thread.GetDomain().FriendlyName; break; case TestCycleScope.Assembly: fullName = _reflectionWorker.GetAssembly(type).FullName; break; case TestCycleScope.Namespace: // Namespace can be null if a type is defined outside any namespace keyword. fullName = _reflectionWorker.GetNamespace(type) ?? Resources.Strings.NoNamespace; break; case TestCycleScope.Class: fullName = _reflectionWorker.GetTypeFullName(type); break; case TestCycleScope.Method: fullName = this.GetTestCycleNameForMethodScope(type); break; } return(fullName); }
/// <summary> /// Resolve parent ID for this test cycle. /// </summary> /// <param name="type"> From which this test cycle is constructed. </param> /// <param name="scope"> Scope of this test cycle. </param> /// <returns> Parent's Guid for this test cycle. </returns> /// <remarks> It is called in constructor. Make sure it does not depend on any class members. </remarks> internal Guid ResolveParentID(Type type, TestCycleScope scope) { string fullName = string.Empty; string fullPath = _reflectionWorker.GetAssemblyFullPath(type); switch (scope) { case TestCycleScope.AppDomain: break; case TestCycleScope.Assembly: fullName = AppDomain.CurrentDomain.FriendlyName; break; case TestCycleScope.Namespace: fullName = type.Assembly.FullName; break; case TestCycleScope.Class: // Namespace can be null if a type is defined outside any namespace keyword. fullName = _reflectionWorker.GetNamespace(type) ?? Resources.Strings.NoNamespace; break; case TestCycleScope.Method: fullName = _reflectionWorker.GetTypeFullName(type); break; } return(HashUtilities.GuidForTestCycleID(fullPath, fullName)); }
public TestCycleBase(string source, Type type, TestCycleScope scope) { this.ParentID = scope == TestCycleScope.AppDomain ? Guid.Empty : ResovleParentID(type, scope); this.FullName = ResolveTestCycleFullName(type, scope); this.Source = source; this.Scope = scope; }
public TestCycleBase(string source, Type type, Guid parentID, TestCycleScope scope) { this.FullName = ResolveTestCycleFullName(type, scope); this.ParentID = parentID; this.Source = source; this.Scope = scope; }
/// <inheritdoc/> public override Guid ResovleParentID(Type type, TestCycleScope scope) { return(_reflectionHelper.ResolveParentID(type, scope)); }
/// <inheritdoc/> public override string ResolveTestCycleFullName(Type type, TestCycleScope scope) { return(_reflectionHelper.ResolveTestCycleFullName(type, scope)); }
public TestCycle(string source, Type type, Guid parentID, TestCycleScope scope) : base(source, type, parentID, scope) { }
public TestCycle(string source, Type type, TestCycleScope scope) : base(source, type, scope) { }
/// <summary> /// Initializes a new instance of the <see cref="TestCycleBase"/> class. /// </summary> /// <param name="source">Source name of the test.</param> /// <param name="type"> The type from which this test cycle is constructed. </param> /// <param name="parentID">ID of parent test cycle.</param> /// <param name="scope">Scope of this test cycle.</param> /// <param name="displayName">Name to display in UI.</param> public TestCycleBase(string source, Type type, Guid parentID, TestCycleScope scope, string displayName) : this(source, type, parentID, scope) { _displayName = displayName; }