public void Setup()
        {
            _graph = new ConversionGraph();

            var meter = SI.Length.Meter;
            var mile  = US.Length.Mile;
            var feet  = US.Length.Foot;

            feet.PluralizeAs("feet");

            var kilometer = SI.Length.Kilometer.HasCounterPart(mile);

            var nanofoot  = new Unit("nanofoot").SystemIs("US");
            var nanometer = new Unit("nanometer").SystemIs("metric");
            var picometer = new Unit("picometer").SystemIs("metric");

            nanofoot.HasCounterPart(nanometer);

            _graph.AddConversion(Conversions.One(meter).In(feet).Is(3.28084M));
            _graph.AddConversion(Conversions.One(kilometer).In(meter).Is(1000M));
            _graph.AddConversion(Conversions.One(mile).In(feet).Is(5280M));
            _graph.AddConversion(Conversions.From(feet).To(nanofoot).MultiplyBy(0.000000001M));
            _graph.AddConversion(Conversions.From(picometer).To(nanometer).MultiplyBy(0.001M));
            _graph
            .RoundUsing(MidpointRounding.AwayFromZero)
            .RoundToDecimalPlaces(4);
        }
Пример #2
0
        public void Setup()
        {
            _graph = new ConversionGraph();

            var meter = SI.Length.Meter;

            meter
            .UsePluralFormat("{0}s")
            .CanBeAbbreviated("mtr")
            .IsAlsoCalled("Metres");

            var feet = US.Length.Foot;

            feet.PluralizeAs("feet");

            Conversion c = Conversions.One(meter).In(feet).Is(3.28084M);

            _graph.AddConversion(c);

            Conversion x = Conversions.One(SI.Length.Kilometer).In(meter).Is(1000M);

            _graph.AddConversion(x);

            _graph
            .RoundUsing(MidpointRounding.AwayFromZero)
            .RoundToDecimalPlaces(4);
        }
Пример #3
0
        public void Setup()
        {
            _graph = new ConversionGraph();

            var meter     = SI.Length.Meter;
            var feet      = US.Length.Foot;
            var kilometer = SI.Length.Kilometer;

            Conversion c = Conversions.One(meter).In(feet).Is(3.28084M);

            _graph.AddConversion(c);

            Conversion x = Conversions.One(kilometer).In(meter).Is(1000M);

            _graph.AddConversion(x);

            _graph
            .RoundUsing(MidpointRounding.AwayFromZero)
            .RoundToDecimalPlaces(4);
        }
Пример #4
0
        public void Setup()
        {
            _graph = new ConversionGraph();

            var meter = SI.Length.Meter;
            var feet = US.Length.Foot;
            var kilometer = SI.Length.Kilometer;

            Conversion c = Conversions.One(meter).In(feet).Is(3.28084M);

            _graph.AddConversion(c);

            Conversion x = Conversions.One(kilometer).In(meter).Is(1000M);

            _graph.AddConversion(x);

            _graph
                .RoundUsing(MidpointRounding.AwayFromZero)
                .RoundToDecimalPlaces(4);
        }
Пример #5
0
        public void Setup()
        {
            _graph = new ConversionGraph();

            var meter = SI.Length.Meter;

            meter
                .UsePluralFormat("{0}s")
                .CanBeAbbreviated("mtr")
                .IsAlsoCalled("Metres");

            var feet = US.Length.Foot;
            feet.PluralizeAs("feet");

            Conversion c = Conversions.One(meter).In(feet).Is(3.28084M);

            _graph.AddConversion(c);

            Conversion x = Conversions.One(SI.Length.Kilometer).In(meter).Is(1000M);

            _graph.AddConversion(x);

            _graph
                .RoundUsing(MidpointRounding.AwayFromZero)
                .RoundToDecimalPlaces(4);
        }
Пример #6
0
        public void Setup()
        {
            _graph = new ConversionGraph();

            var meter = SI.Length.Meter;
            var mile = US.Length.Mile;
            var feet = US.Length.Foot;
            feet.PluralizeAs("feet");

            var kilometer = SI.Length.Kilometer.HasCounterPart(mile);

            var nanofoot = new Unit("nanofoot").SystemIs("US");
            var nanometer = new Unit("nanometer").SystemIs("metric");
            var picometer = new Unit("picometer").SystemIs("metric");
            nanofoot.HasCounterPart(nanometer);

            _graph.AddConversion(Conversions.One(meter).In(feet).Is(3.28084M));
            _graph.AddConversion(Conversions.One(kilometer).In(meter).Is(1000M));
            _graph.AddConversion(Conversions.One(mile).In(feet).Is(5280M));
            _graph.AddConversion(Conversions.From(feet).To(nanofoot).MultiplyBy(0.000000001M));
            _graph.AddConversion(Conversions.From(picometer).To(nanometer).MultiplyBy(0.001M));
            _graph
                .RoundUsing(MidpointRounding.AwayFromZero)
                .RoundToDecimalPlaces(4);
        }