diff --git a/Source/Tracking/TransactionGroup.Test.cs b/Source/Tracking/TransactionGroup.Test.cs index a1b778d..6488237 100644 --- a/Source/Tracking/TransactionGroup.Test.cs +++ b/Source/Tracking/TransactionGroup.Test.cs @@ -260,10 +260,11 @@ namespace Nuclex.Support.Tracking { } /// - /// Validates that the ended event is triggered when the last transaction ends + /// Validates that the ended event is triggered when the last transaction out of + /// multiple transactions in the group ends. /// [Test] - public void TestEndedEvent() { + public void TestEndedEventWithTwoTransactions() { using( TransactionGroup testTransactionGroup = new TransactionGroup( @@ -287,6 +288,34 @@ namespace Nuclex.Support.Tracking { } } + /// + /// Validates that the ended event is triggered when a single transaction contained + /// in the group ends. + /// + [Test] + public void TestEndedEventWithSingleTransaction() { + using( + TransactionGroup testTransactionGroup = + new TransactionGroup( + new TestTransaction[] { new TestTransaction() } + ) + ) { + ITransactionGroupSubscriber mockedSubscriber = mockSubscriber(testTransactionGroup); + + Expect.Once.On(mockedSubscriber). + Method("ProgressChanged"). + WithAnyArguments(); + + Expect.Once.On(mockedSubscriber). + Method("Ended"). + WithAnyArguments(); + + testTransactionGroup.Children[0].Transaction.End(); + + this.mockery.VerifyAllExpectationsHaveBeenMet(); + } + } + /// /// Verifies that the transaction group immediately enters the ended state when /// the contained transactions have already ended before the constructor