File tree Expand file tree Collapse file tree
ModuleManagerTests/Progress Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public float ProgressFraction
1616 get
1717 {
1818 if ( Counter . totalPatches > 0 )
19- return ( Counter . appliedPatches + Counter . needsUnsatisfied ) / ( float ) Counter . totalPatches ;
19+ return Counter . appliedPatches / ( float ) Counter . totalPatches ;
2020 return 0 ;
2121 }
2222 }
Original file line number Diff line number Diff line change @@ -276,5 +276,37 @@ public void TestException__Url()
276276 Assert . Equal ( 2 , progress . Counter . errorFiles [ "abc/def.cfg" ] ) ;
277277 logger . Received ( ) . Exception ( "An exception was tossed" , e2 ) ;
278278 }
279+
280+ [ Fact ]
281+ public void TestProgressFraction ( )
282+ {
283+ Assert . Equal ( 0 , progress . ProgressFraction ) ;
284+
285+ progress . Counter . needsUnsatisfied . Increment ( ) ;
286+ progress . Counter . needsUnsatisfied . Increment ( ) ;
287+
288+ progress . Counter . totalPatches . Increment ( ) ;
289+ progress . Counter . totalPatches . Increment ( ) ;
290+ progress . Counter . totalPatches . Increment ( ) ;
291+ progress . Counter . totalPatches . Increment ( ) ;
292+
293+ Assert . Equal ( 0 , progress . ProgressFraction ) ;
294+
295+ progress . Counter . appliedPatches . Increment ( ) ;
296+
297+ Assert . Equal ( 0.25 , progress . ProgressFraction ) ;
298+
299+ progress . Counter . appliedPatches . Increment ( ) ;
300+
301+ Assert . Equal ( 0.5 , progress . ProgressFraction ) ;
302+
303+ progress . Counter . appliedPatches . Increment ( ) ;
304+
305+ Assert . Equal ( 0.75 , progress . ProgressFraction ) ;
306+
307+ progress . Counter . appliedPatches . Increment ( ) ;
308+
309+ Assert . Equal ( 1 , progress . ProgressFraction ) ;
310+ }
279311 }
280312}
You can’t perform that action at this time.
0 commit comments