public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.BitPerSecond).BitsPerSecond, BitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.BytePerSecond).BytesPerSecond, BytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExabitPerSecond).ExabitsPerSecond, ExabitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExabytePerSecond).ExabytesPerSecond, ExabytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExbibitPerSecond).ExbibitsPerSecond, ExbibitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExbibytePerSecond).ExbibytesPerSecond, ExbibytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GibibitPerSecond).GibibitsPerSecond, GibibitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GibibytePerSecond).GibibytesPerSecond, GibibytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GigabitPerSecond).GigabitsPerSecond, GigabitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GigabytePerSecond).GigabytesPerSecond, GigabytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KibibitPerSecond).KibibitsPerSecond, KibibitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KibibytePerSecond).KibibytesPerSecond, KibibytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KilobitPerSecond).KilobitsPerSecond, KilobitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KilobytePerSecond).KilobytesPerSecond, KilobytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MebibitPerSecond).MebibitsPerSecond, MebibitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MebibytePerSecond).MebibytesPerSecond, MebibytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MegabitPerSecond).MegabitsPerSecond, MegabitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MegabytePerSecond).MegabytesPerSecond, MegabytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PebibitPerSecond).PebibitsPerSecond, PebibitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PebibytePerSecond).PebibytesPerSecond, PebibytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PetabitPerSecond).PetabitsPerSecond, PetabitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PetabytePerSecond).PetabytesPerSecond, PetabytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TebibitPerSecond).TebibitsPerSecond, TebibitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TebibytePerSecond).TebibytesPerSecond, TebibytesPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TerabitPerSecond).TerabitsPerSecond, TerabitsPerSecondTolerance);
     AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TerabytePerSecond).TerabytesPerSecond, TerabytesPerSecondTolerance);
 }
Example #2
0
        public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit()
        {
            var quantity00 = BitRate.From(1, BitRateUnit.BitPerSecond);

            AssertEx.EqualTolerance(1, quantity00.BitsPerSecond, BitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.BitPerSecond, quantity00.Unit);

            var quantity01 = BitRate.From(1, BitRateUnit.BytePerSecond);

            AssertEx.EqualTolerance(1, quantity01.BytesPerSecond, BytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.BytePerSecond, quantity01.Unit);

            var quantity02 = BitRate.From(1, BitRateUnit.ExabitPerSecond);

            AssertEx.EqualTolerance(1, quantity02.ExabitsPerSecond, ExabitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.ExabitPerSecond, quantity02.Unit);

            var quantity03 = BitRate.From(1, BitRateUnit.ExabytePerSecond);

            AssertEx.EqualTolerance(1, quantity03.ExabytesPerSecond, ExabytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.ExabytePerSecond, quantity03.Unit);

            var quantity04 = BitRate.From(1, BitRateUnit.ExbibitPerSecond);

            AssertEx.EqualTolerance(1, quantity04.ExbibitsPerSecond, ExbibitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.ExbibitPerSecond, quantity04.Unit);

            var quantity05 = BitRate.From(1, BitRateUnit.ExbibytePerSecond);

            AssertEx.EqualTolerance(1, quantity05.ExbibytesPerSecond, ExbibytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.ExbibytePerSecond, quantity05.Unit);

            var quantity06 = BitRate.From(1, BitRateUnit.GibibitPerSecond);

            AssertEx.EqualTolerance(1, quantity06.GibibitsPerSecond, GibibitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.GibibitPerSecond, quantity06.Unit);

            var quantity07 = BitRate.From(1, BitRateUnit.GibibytePerSecond);

            AssertEx.EqualTolerance(1, quantity07.GibibytesPerSecond, GibibytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.GibibytePerSecond, quantity07.Unit);

            var quantity08 = BitRate.From(1, BitRateUnit.GigabitPerSecond);

            AssertEx.EqualTolerance(1, quantity08.GigabitsPerSecond, GigabitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.GigabitPerSecond, quantity08.Unit);

            var quantity09 = BitRate.From(1, BitRateUnit.GigabytePerSecond);

            AssertEx.EqualTolerance(1, quantity09.GigabytesPerSecond, GigabytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.GigabytePerSecond, quantity09.Unit);

            var quantity10 = BitRate.From(1, BitRateUnit.KibibitPerSecond);

            AssertEx.EqualTolerance(1, quantity10.KibibitsPerSecond, KibibitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.KibibitPerSecond, quantity10.Unit);

            var quantity11 = BitRate.From(1, BitRateUnit.KibibytePerSecond);

            AssertEx.EqualTolerance(1, quantity11.KibibytesPerSecond, KibibytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.KibibytePerSecond, quantity11.Unit);

            var quantity12 = BitRate.From(1, BitRateUnit.KilobitPerSecond);

            AssertEx.EqualTolerance(1, quantity12.KilobitsPerSecond, KilobitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.KilobitPerSecond, quantity12.Unit);

            var quantity13 = BitRate.From(1, BitRateUnit.KilobytePerSecond);

            AssertEx.EqualTolerance(1, quantity13.KilobytesPerSecond, KilobytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.KilobytePerSecond, quantity13.Unit);

            var quantity14 = BitRate.From(1, BitRateUnit.MebibitPerSecond);

            AssertEx.EqualTolerance(1, quantity14.MebibitsPerSecond, MebibitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.MebibitPerSecond, quantity14.Unit);

            var quantity15 = BitRate.From(1, BitRateUnit.MebibytePerSecond);

            AssertEx.EqualTolerance(1, quantity15.MebibytesPerSecond, MebibytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.MebibytePerSecond, quantity15.Unit);

            var quantity16 = BitRate.From(1, BitRateUnit.MegabitPerSecond);

            AssertEx.EqualTolerance(1, quantity16.MegabitsPerSecond, MegabitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.MegabitPerSecond, quantity16.Unit);

            var quantity17 = BitRate.From(1, BitRateUnit.MegabytePerSecond);

            AssertEx.EqualTolerance(1, quantity17.MegabytesPerSecond, MegabytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.MegabytePerSecond, quantity17.Unit);

            var quantity18 = BitRate.From(1, BitRateUnit.PebibitPerSecond);

            AssertEx.EqualTolerance(1, quantity18.PebibitsPerSecond, PebibitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.PebibitPerSecond, quantity18.Unit);

            var quantity19 = BitRate.From(1, BitRateUnit.PebibytePerSecond);

            AssertEx.EqualTolerance(1, quantity19.PebibytesPerSecond, PebibytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.PebibytePerSecond, quantity19.Unit);

            var quantity20 = BitRate.From(1, BitRateUnit.PetabitPerSecond);

            AssertEx.EqualTolerance(1, quantity20.PetabitsPerSecond, PetabitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.PetabitPerSecond, quantity20.Unit);

            var quantity21 = BitRate.From(1, BitRateUnit.PetabytePerSecond);

            AssertEx.EqualTolerance(1, quantity21.PetabytesPerSecond, PetabytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.PetabytePerSecond, quantity21.Unit);

            var quantity22 = BitRate.From(1, BitRateUnit.TebibitPerSecond);

            AssertEx.EqualTolerance(1, quantity22.TebibitsPerSecond, TebibitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.TebibitPerSecond, quantity22.Unit);

            var quantity23 = BitRate.From(1, BitRateUnit.TebibytePerSecond);

            AssertEx.EqualTolerance(1, quantity23.TebibytesPerSecond, TebibytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.TebibytePerSecond, quantity23.Unit);

            var quantity24 = BitRate.From(1, BitRateUnit.TerabitPerSecond);

            AssertEx.EqualTolerance(1, quantity24.TerabitsPerSecond, TerabitsPerSecondTolerance);
            Assert.Equal(BitRateUnit.TerabitPerSecond, quantity24.Unit);

            var quantity25 = BitRate.From(1, BitRateUnit.TerabytePerSecond);

            AssertEx.EqualTolerance(1, quantity25.TerabytesPerSecond, TerabytesPerSecondTolerance);
            Assert.Equal(BitRateUnit.TerabytePerSecond, quantity25.Unit);
        }