/// <inheritdoc/> public void TearDown() { this.TestCaseStatus.EndTime = DateTime.UtcNow; if (!this.ShouldExecuteVariable) { this.TestCaseStatus.Actual = "Did not run."; } ITestCaseLogger log = new TestCaseLogger(); log.Log(this); }
private static IDisposable InitialiseLogger(ITest test) { IDisposable logCallback = null; if (test is TestFixture) { var logger = Log.CreateFixtureLogger(test.Name); test.Properties.Add(LoggerParameterName, logger); logCallback = logger.EnterReproStep("Initialising fixture"); } if (test is TestMethod) { TestCaseLogger logger = null; if (test.Parent.Properties.ContainsKey(LoggerParameterName)) { if (test.Parent is TestFixture) { logger = (test.Parent.Properties.Get(LoggerParameterName) as FixtureLogger).CreateTestCaseLogger(test.Name); } else { logger = (test.Parent.Properties.Get(LoggerParameterName) as TestMethodLogger).CreateTestCaseLogger(test.Name); } } else { var fixtureLogger = test.Parent.Parent.Properties.Get(LoggerParameterName) as FixtureLogger; var methodLogger = fixtureLogger.CreateTestMethodLogger(test.Parent.Name); test.Parent.Properties.Add(LoggerParameterName, methodLogger); logger = methodLogger.CreateTestCaseLogger(test.Name); } test.Properties.Add(LoggerParameterName, logger); logCallback = logger.EnterReproStep("Pre-test initialisation."); } return(logCallback); }