Ejemplo n.º 1
0
        /// <summary>
        /// Gets the string representation of the bandwidth.
        /// </summary>
        /// <param name="bandwidth">
        /// The bandwidth.
        /// </param>
        /// <returns>
        /// Bandwidth information as string.
        /// </returns>
        protected virtual string GetBandwidth(Bandwidth bandwidth)
        {
            if (BandwidthUnit.Kilobyte == this.BandwidthUnit)
            {
                return bandwidth.Kilobytes.ToString(CultureInfo.InvariantCulture);
            }
            else if (BandwidthUnit.Megabyte == this.BandwidthUnit)
            {
                return bandwidth.Megabytes.ToString(CultureInfo.InvariantCulture);
            }

            return bandwidth.Gigabytes.ToString(CultureInfo.InvariantCulture);
        }
Ejemplo n.º 2
0
 public void Should_return_correct_amount_of_kilobytes()
 {
     uint kilobytes = 1;
     var bandwidth = new Bandwidth(kilobytes);
     Assert.AreEqual(kilobytes, bandwidth.Kilobytes);
 }
Ejemplo n.º 3
0
 public void Should_return_correct_amount_of_megabytes()
 {
     uint kilobytes = 7387099;
     var bandwidth = new Bandwidth(kilobytes);
     Assert.AreEqual(7213.96, bandwidth.Megabytes);
 }
Ejemplo n.º 4
0
 public void Should_return_correct_amount_of_gigabytes()
 {
     uint kilobytes = 7388199;
     var bandwidth = new Bandwidth(kilobytes);
     Assert.AreEqual(7.05, bandwidth.Gigabytes);
 }