File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public static string ToFileSizeString(long size)
42
42
}
43
43
else
44
44
{
45
- return ( ( size >> 50 ) / 1024F ) . ToString ( "F0 " ) + " EB" ;
45
+ return ( ( size >> 50 ) / 1024F ) . ToString ( "F1 " ) + " EB" ;
46
46
}
47
47
}
48
48
}
Original file line number Diff line number Diff line change
1
+ // Licensed to the .NET Foundation under one or more agreements.
2
+ // The .NET Foundation licenses this file to you under the MIT license.
3
+ // See the LICENSE file in the project root for more information.
4
+
5
+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
6
+
7
+ namespace CommunityToolkit . Common . UnitTests ;
8
+
9
+ [ TestClass ]
10
+ public class Test_Converters
11
+ {
12
+ [ TestMethod ]
13
+ [ DataRow ( 1024L - 1 , "1023 bytes" ) ]
14
+ [ DataRow ( 1024L , "1.0 KB" ) ]
15
+ [ DataRow ( 1024L * 1024 , "1.0 MB" ) ]
16
+ [ DataRow ( 1024L * 1024 * 1024 , "1.0 GB" ) ]
17
+ [ DataRow ( 1024L * 1024 * 1024 * 1024 , "1.0 TB" ) ]
18
+ [ DataRow ( 1024L * 1024 * 1024 * 1024 * 1024 , "1.0 PB" ) ]
19
+ [ DataRow ( 1024L * 1024 * 1024 * 1024 * 1024 * 1024 , "1.0 EB" ) ]
20
+ public void Test_ToFileSizeString ( long size , string expected )
21
+ {
22
+ Assert . AreEqual ( expected , Converters . ToFileSizeString ( size ) ) ;
23
+ }
24
+ }
You can’t perform that action at this time.
0 commit comments