Fixed some minor deviations from the coding conventions in the ProgressTracker class

git-svn-id: file:///srv/devel/repo-conversion/nusu@119 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2009-02-01 20:54:01 +00:00
parent 1f1faac82a
commit a3de5b041c

View File

@ -40,13 +40,13 @@ namespace Nuclex.Support.Tracking {
/// <summary>Called when the tracked progress changes</summary> /// <summary>Called when the tracked progress changes</summary>
/// <param name="sender">Progress tracker whose progress has changed</param> /// <param name="sender">Progress tracker whose progress has changed</param>
/// <param name="e">Contains the new progress achieved</param> /// <param name="arguments">Contains the new progress achieved</param>
void ProgressChanged(object sender, ProgressReportEventArgs e); void ProgressChanged(object sender, ProgressReportEventArgs arguments);
/// <summary>Called when the progress tracker's idle state changes</summary> /// <summary>Called when the progress tracker's idle state changes</summary>
/// <param name="sender">Progress tracker whose idle state has changed</param> /// <param name="sender">Progress tracker whose idle state has changed</param>
/// <param name="e">Contains the new idle state of the tracker</param> /// <param name="arguments">Contains the new idle state of the tracker</param>
void IdleStateChanged(object sender, IdleStateEventArgs e); void IdleStateChanged(object sender, IdleStateEventArgs arguments);
} }
@ -54,10 +54,10 @@ namespace Nuclex.Support.Tracking {
#region class ProgressUpdateEventArgsMatcher #region class ProgressUpdateEventArgsMatcher
/// <summary>Compares two ProgressUpdateEventArgsInstances for NMock validation</summary> /// <summary>Compares two ProgressUpdateEventArgs instances</summary>
private class ProgressReportEventArgsMatcher : Matcher { private class ProgressReportEventArgsMatcher : Matcher {
/// <summary>Initializes a new ProgressUpdateEventArgsMatcher </summary> /// <summary>Initializes a new ProgressUpdateEventArgsMatcher</summary>
/// <param name="expected">Expected progress update event arguments</param> /// <param name="expected">Expected progress update event arguments</param>
public ProgressReportEventArgsMatcher(ProgressReportEventArgs expected) { public ProgressReportEventArgsMatcher(ProgressReportEventArgs expected) {
this.expected = expected; this.expected = expected;
@ -140,14 +140,14 @@ namespace Nuclex.Support.Tracking {
#region class EvilTransaction #region class EvilTransaction
/// <summary> /// <summary>
/// Transaction that tries to emulate a thread given a progress report at /// Transaction that tries to emulate a thread giving a progress report at
/// a very inconvenient time ;) /// a very inconvenient time ;)
/// </summary> /// </summary>
private class EvilTransaction : Transaction, IProgressReporter { private class EvilTransaction : Transaction, IProgressReporter {
/// <summary>will be triggered to report when progress has been achieved</summary> /// <summary>will be triggered to report when progress has been achieved</summary>
public event EventHandler<ProgressReportEventArgs> AsyncProgressChanged { public event EventHandler<ProgressReportEventArgs> AsyncProgressChanged {
add {} add { }
remove { remove {
// Send a progress update right when the subscriber is trying to unsubscribe // Send a progress update right when the subscriber is trying to unsubscribe
value(this, new ProgressReportEventArgs(0.5f)); value(this, new ProgressReportEventArgs(0.5f));
@ -175,19 +175,15 @@ namespace Nuclex.Support.Tracking {
// Step 1 // Step 1
{ {
Expect.Once.On(mockedSubscriber). Expect.Once.On(mockedSubscriber).Method("IdleStateChanged").WithAnyArguments();
Method("IdleStateChanged").
WithAnyArguments();
// Since the progress is already at 0, these redundant reports are optional // Since the progress is already at 0, these redundant reports are optional
Expect.Between(0, 2).On(mockedSubscriber). Expect.Between(0, 2).On(mockedSubscriber).Method("ProgressChanged").With(
Method("ProgressChanged"). new Matcher[] {
With(
new Matcher[] {
new NMock2.Matchers.TypeMatcher(typeof(ProgressTracker)), new NMock2.Matchers.TypeMatcher(typeof(ProgressTracker)),
new ProgressReportEventArgsMatcher(new ProgressReportEventArgs(0.0f)) new ProgressReportEventArgsMatcher(new ProgressReportEventArgs(0.0f))
} }
); );
tracker.Track(test1); tracker.Track(test1);
tracker.Track(test2); tracker.Track(test2);
@ -195,14 +191,12 @@ namespace Nuclex.Support.Tracking {
// Step 2 // Step 2
{ {
Expect.Once.On(mockedSubscriber). Expect.Once.On(mockedSubscriber).Method("ProgressChanged").With(
Method("ProgressChanged"). new Matcher[] {
With(
new Matcher[] {
new NMock2.Matchers.TypeMatcher(typeof(ProgressTracker)), new NMock2.Matchers.TypeMatcher(typeof(ProgressTracker)),
new ProgressReportEventArgsMatcher(new ProgressReportEventArgs(0.25f)) new ProgressReportEventArgsMatcher(new ProgressReportEventArgs(0.25f))
} }
); );
test1.ChangeProgress(0.5f); test1.ChangeProgress(0.5f);
} }