Пример #1
0
 public void BasicFormattingTests()
 {
     // Ensures that the basic formatting works. The actual details of how the number is converted
     // into a human readable size are implemented by the Win32 API StrFormatByteSizeW. This test ensures
     // that we can call into the API and get a valid result.
     Assert.AreEqual("10 bytes", StringFormatUtils.FormatByteSize(10));
     Assert.AreEqual("1.00 KB", StringFormatUtils.FormatByteSize(1024));
     Assert.AreEqual("1.00 MB", StringFormatUtils.FormatByteSize(1024 * 1024));
     Assert.AreEqual("1.00 GB", StringFormatUtils.FormatByteSize(1024 * 1024 * 1024));
 }
Пример #2
0
 /// <summary>
 /// Takes in the <paramref name="size"/> and returns a human readable version of the size
 /// with the KB, MB, etc... suffix.
 /// </summary>
 private static string FormatSize(ulong size)
 {
     return(StringFormatUtils.FormatByteSize(size));
 }