Exemple #1
0
 public void Equality()
 {
     Assert.AreEqual(PrettySize.KiB(1), PrettySize.Bytes(1024));
     Assert.AreEqual(PrettySize.KiB(-1), PrettySize.Bytes(-1024));
     Assert.IsTrue(PrettySize.KiB(42) == PrettySize.Kibibytes(42));
     Assert.IsTrue(PrettySize.KiB(42) != PrettySize.Kibibytes(43));
 }
Exemple #2
0
 public void Comparison()
 {
     Assert.IsTrue(PrettySize.KiB(1) > PrettySize.KB(1));
     Assert.IsTrue(PrettySize.KiB(-2) < PrettySize.Bytes(-1));
     Assert.IsTrue(PrettySize.KiB(2) >= PrettySize.KiB(2));
     Assert.IsTrue(PrettySize.KiB(2) >= PrettySize.KiB(1));
     Assert.IsTrue(PrettySize.KiB(1) <= PrettySize.KiB(2));
     Assert.IsTrue(PrettySize.KiB(1) <= PrettySize.KiB(1));
 }
Exemple #3
0
 public void NegativeSubtraction()
 {
     Assert.AreEqual(PrettySize.KiB(4) - PrettySize.KiB(8), PrettySize.KiB(-4));
 }
Exemple #4
0
 public void Subtraction()
 {
     Assert.AreEqual(PrettySize.KiB(4) - PrettySize.KiB(2), PrettySize.KiB(2));
 }
Exemple #5
0
 public void Addition()
 {
     Assert.AreEqual(PrettySize.KiB(4) + PrettySize.KiB(8), PrettySize.KiB(12));
 }
Exemple #6
0
 public void NegativeSizeFormatting()
 {
     Assert.AreEqual("0 bytes", PrettySize.KiB(-0).ToString());
     Assert.AreEqual("-1 byte", PrettySize.Bytes(-1).ToString());
     Assert.AreEqual("-1.00 KiB", PrettySize.KiB(-1).ToString());
 }
Exemple #7
0
 public void NegativeSizes()
 {
     Assert.AreEqual(-1024, PrettySize.KiB(-1).TotalBytes);
     Assert.AreEqual(0, PrettySize.KiB(-0).TotalBytes);
     Assert.AreEqual(PrettySize.KiB(-1), PrettySize.KiB(1) - PrettySize.Bytes(2048));
 }