From 96061c688cdf64bd87a870f4a67c4468eb7dfd1e Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Mon, 30 Mar 2009 20:08:12 +0000 Subject: [PATCH] Added another unit test for the transaction group git-svn-id: file:///srv/devel/repo-conversion/nusu@124 d2e56fa2-650e-0410-a79f-9358c0239efd --- Source/Tracking/TransactionGroup.Test.cs | 33 ++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) 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