public void MetadataAdditionsAreVisibleInStepInfo() { Assert.IsNull(TestStep.CurrentStep.Metadata.GetValue("New")); TestStep.AddMetadata("New", "And improved!"); Assert.AreEqual("And improved!", TestStep.CurrentStep.Metadata.GetValue("New")); TestStep.AddMetadata("New", "Now with less sugar."); Assert.AreElementsEqual(new string[] { "And improved!", "Now with less sugar." }, TestStep.CurrentStep.Metadata["New"]); }
protected override TestOutcome RunDynamicTest(ICodeElementInfo declaringCodeElement, Action setUp, Action tearDown) { return(TestStep.RunStep(Name, () => { TestStep.AddMetadata(MetadataKeys.TestKind, Kind); foreach (var pair in Metadata.Pairs) { TestStep.AddMetadata(pair.Key, pair.Value); } try { TestContext.CurrentContext.LifecyclePhase = LifecyclePhases.SetUp; if (setUp != null) { setUp(); } try { OnSetupSelf(); TestContext.CurrentContext.LifecyclePhase = LifecyclePhases.Execute; OnExecuteSelf(); TestOutcome outcome = RunDynamicTests(GetChildren(), declaringCodeElement, OnSetupChild, OnTearDownChild); if (outcome != TestOutcome.Passed) { throw new SilentTestException(outcome); } } finally { TestContext.CurrentContext.LifecyclePhase = LifecyclePhases.TearDown; OnTearDownSelf(); } } finally { TestContext.CurrentContext.LifecyclePhase = LifecyclePhases.TearDown; if (tearDown != null) { tearDown(); } } }, Timeout, IsTestCase, CodeElement ?? declaringCodeElement).Outcome); }