Queue operation fully implemented; added small unit test for queue operation; some comment improvements in other code sections

git-svn-id: file:///srv/devel/repo-conversion/nusu@36 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2007-07-10 18:15:34 +00:00
parent 850db0cded
commit 4933604495
7 changed files with 357 additions and 33 deletions

View file

@ -34,7 +34,7 @@ namespace Nuclex.Support.Tracking {
/// This class does not implement the IProgression interface itself in
/// order to not violate the design principles of progressions which
/// guarantee that a progression will only finish once (whereas the
/// progression tracking might finish any number of times).
/// progression tracker might 'finish' any number of times).
/// </para>
/// </remarks>
public class ProgressionTracker : IDisposable {
@ -98,6 +98,10 @@ namespace Nuclex.Support.Tracking {
public void Dispose() {
lock(this.trackedProgressions) {
// Get rid of all progression we're tracking. This unsubscribes the
// observers from the events of the progressions and stops us from
// being kept alive and receiving any further events if some of the
// tracked progressions are still executing.
for(int index = 0; index < this.trackedProgressions.Count; ++index)
this.trackedProgressions[index].Dispose();

View file

@ -180,20 +180,6 @@ namespace Nuclex.Support.Tracking {
this.mockery.VerifyAllExpectationsHaveBeenMet();
}
/// <summary>Mocks a subscriber for the events of a progression</summary>
/// <param name="progression">Progression to mock an event subscriber for</param>
/// <returns>The mocked event subscriber</returns>
private ISetProgressionSubscriber mockSubscriber(Progression progression) {
ISetProgressionSubscriber mockedSubscriber =
this.mockery.NewMock<ISetProgressionSubscriber>();
progression.AsyncEnded += new EventHandler(mockedSubscriber.Ended);
progression.AsyncProgressUpdated +=
new EventHandler<ProgressUpdateEventArgs>(mockedSubscriber.ProgressUpdated);
return mockedSubscriber;
}
/// <summary>
/// Validates that the ended event is triggered when the last progression ends
/// </summary>
@ -220,6 +206,20 @@ namespace Nuclex.Support.Tracking {
this.mockery.VerifyAllExpectationsHaveBeenMet();
}
/// <summary>Mocks a subscriber for the events of a progression</summary>
/// <param name="progression">Progression to mock an event subscriber for</param>
/// <returns>The mocked event subscriber</returns>
private ISetProgressionSubscriber mockSubscriber(Progression progression) {
ISetProgressionSubscriber mockedSubscriber =
this.mockery.NewMock<ISetProgressionSubscriber>();
progression.AsyncEnded += new EventHandler(mockedSubscriber.Ended);
progression.AsyncProgressUpdated +=
new EventHandler<ProgressUpdateEventArgs>(mockedSubscriber.ProgressUpdated);
return mockedSubscriber;
}
/// <summary>Mock object factory</summary>
private Mockery mockery;

View file

@ -167,7 +167,7 @@ namespace Nuclex.Support.Tracking {
/// WeightedProgression interface
/// </summary>
private volatile WeightedProgressionWrapperCollection<ProgressionType> wrapper;
/// <summary>Summed weight of all progression in the set</summary>
/// <summary>Summed weight of all progressions in the set</summary>
private float totalWeight;
}