@@ -227,5 +227,48 @@ public void HistoryAndTestCaseIdsAreNotOverwrittenAfterStop()
227227 Assert . That ( lifecycle . Context . CurrentTest . historyId , Is . EqualTo ( "history-id" ) ) ;
228228 Assert . That ( lifecycle . Context . CurrentTest . testCaseId , Is . EqualTo ( "testcase-id" ) ) ;
229229 }
230+
231+ [ Test ]
232+ public void EmptyTestContainerNotWritten ( )
233+ {
234+ var writer = new InMemoryResultsWriter ( ) ;
235+ var lifecycle = new AllureLifecycle ( _ => writer ) ;
236+ lifecycle . StartTestContainer ( new ( ) { uuid = "foo" } ) ;
237+ lifecycle . StopTestContainer ( ) ;
238+
239+ lifecycle . WriteTestContainer ( ) ;
240+
241+ Assert . That ( writer . testContainers , Is . Empty ) ;
242+ }
243+
244+ [ Test ]
245+ public void ContainerWithBeforeFixtureIsWritten ( )
246+ {
247+ var writer = new InMemoryResultsWriter ( ) ;
248+ var lifecycle = new AllureLifecycle ( _ => writer ) ;
249+ lifecycle . StartTestContainer ( new ( ) { uuid = "foo" } ) ;
250+ lifecycle . StartBeforeFixture ( new ( ) ) ;
251+ lifecycle . StopFixture ( ) ;
252+ lifecycle . StopTestContainer ( ) ;
253+
254+ lifecycle . WriteTestContainer ( ) ;
255+
256+ Assert . That ( writer . testContainers , Has . One . Items ) ;
257+ }
258+
259+ [ Test ]
260+ public void ContainerWithAfterFixtureIsWritten ( )
261+ {
262+ var writer = new InMemoryResultsWriter ( ) ;
263+ var lifecycle = new AllureLifecycle ( _ => writer ) ;
264+ lifecycle . StartTestContainer ( new ( ) { uuid = "foo" } ) ;
265+ lifecycle . StartAfterFixture ( new ( ) ) ;
266+ lifecycle . StopFixture ( ) ;
267+ lifecycle . StopTestContainer ( ) ;
268+
269+ lifecycle . WriteTestContainer ( ) ;
270+
271+ Assert . That ( writer . testContainers , Has . One . Items ) ;
272+ }
230273 }
231274}
0 commit comments