public void ManyDisposablesInASingleStep(Type feature, ITestResultMessage[] results) { "Given {0}" .f(() => { }); "When running the scenario" .f(() => results = this.Run<ITestResultMessage>(feature)); "And there should be no failures" .f(() => results.Should().ContainItemsAssignableTo<ITestPassed>()); #if !V2 "And all but the last result should not be generated by a teardown" .f(() => results.Reverse().Skip(1).Should().NotContain( result => result.Test.DisplayName.IndexOf("(Teardown)", StringComparison.OrdinalIgnoreCase) >= 0)); "And the last result should be generated by a teardown" .f(() => results.Last().Test.DisplayName.Should().Contain("(Teardown)")); #endif "And the disposables should each have been disposed in reverse order" .f(() => typeof(ObjectDisposalFeature).GetTestEvents() .Should().Equal("disposed3", "disposed2", "disposed1")); }