Skip to content

Commit e7c979b

Browse files
committed
Assertions refined
1 parent 8085cfe commit e7c979b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Foundation/Diagnostics/Progress.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Diagnostics;
23
using Foundation.Assertions;
34
using Foundation.Core;
45

@@ -28,9 +29,9 @@ public Progress(int startPercent, int endPercent, int taskCount, long startTimes
2829

2930
public void Add(int value, long timestamp)
3031
{
31-
Assert.IsTrue(value >= 0);
32+
Assert.IsGreaterThanOrEqual(value, 0);
3233
var newTaskCount = _currentTaskCount + value;
33-
Assert.IsTrue(newTaskCount <= _taskCount);
34+
Assert.IsLessThanOrEqual(newTaskCount, _taskCount);
3435

3536
var newRatio = (double)newTaskCount / _taskCount;
3637
var newPercentDouble = _startPercent + newRatio * (_endPercent - _startPercent);
@@ -39,7 +40,7 @@ public void Add(int value, long timestamp)
3940
var estimatedTimeAmount = (long)(elapsedTimeAmount / newRatio);
4041
var estimatedTimeAmountString = StopwatchTimeSpan.ToString(estimatedTimeAmount, 3);
4142

42-
System.Diagnostics.Debug.WriteLine(
43+
Debug.WriteLine(
4344
$"newTaskCount: {newTaskCount}, newPercentDouble: {newPercentDouble}, elapsed: {StopwatchTimeSpan.ToString(elapsedTimeAmount, 3)} estimatedTimeAmount: {estimatedTimeAmountString}");
4445

4546
var newPercent = (int)newPercentDouble;

0 commit comments

Comments
 (0)