/// <summary> /// Runs through the metadata for bugs. /// </summary> private void CheckForKnownBugs() { // TODO: Instead move this logic into the model manager. // This needs to be a set of events off of the main harness! List <string> knownBugs = new List <string>(2); List <string> fixedBugs = new List <string>(2); ICollection <Attribute> bugs = ReflectionUtility.GetAttributes(_metadata, typeof(BugAttribute), false); if (bugs != null && bugs.Count > 0) { foreach (Attribute attribute in bugs) { BugAttribute bug = (BugAttribute)attribute; if (bug.Fixed) { fixedBugs.Add(bug.Description); } else { knownBugs.Add(bug.Description); } } } if (knownBugs.Count > 0) { KnownBugs = knownBugs; } if (fixedBugs.Count > 0) { FixedBugs = fixedBugs; } }
/// <summary> /// First invoke, plan for the method's execution. /// </summary> protected override void FirstInvoke() { // [Ignore] if (Provider.HasCapability(UnitTestProviderCapabilities.MethodCanIgnore) && _testMethod.Ignore) { LogWriter.Ignore(TestGranularity.TestScenario, _testMethod.Name); return; } _testMethod.DecorateInstance(_instance); _testMethod.WriteLine += (object sender, StringEventArgs e) => OnWriteLine(e); // Log Start LogStartMessage(); // [Bug] attributes that are not fixed modify test method logic ICollection <Attribute> bugs = ReflectionUtility.GetAttributes(_testMethod, typeof(BugAttribute), false); if (bugs != null && bugs.Count > 0) { foreach (Attribute attribute in bugs) { BugAttribute bug = attribute as BugAttribute; if (!bug.Fixed) { _bugAttributePresent = true; LogWriter.KnownIssue(bug.Description); } } } // [TestInitialize] if (_testClass.TestInitializeMethod != null) { EnqueueMethodDispatcher(_testClass.TestInitializeMethod); } // Track the approximate starting time - actual start time is >= 1 dispatcher interval EnqueueQuick(() => _started = DateTime.Now); // [TestMethod] - actual test scenario _mainTestMethodContainer = new UnitTestMethodContainer(TestHarness, _instance, _testMethod.Method, _testMethod, TestGranularity.TestScenario); _mainTestMethodContainer.UnhandledException += new EventHandler <UnhandledExceptionEventArgs>(UnhandledMethodException); _mainTestMethodContainer.Complete += new EventHandler(CompleteMethod); Enqueue(_mainTestMethodContainer); // [TestCleanup] if (_testClass.TestCleanupMethod != null) { EnqueueMethodDispatcher(_testClass.TestCleanupMethod); } // Log End EnqueueQuick(LogEndMessage); }