Beispiel #1
0
        public void ConvertToSame()
        {
            var value = conv.Convert(1, AreaUnits.SquareMetres, AreaUnits.SquareMetres);

            Assert.Equal(1, value);
        }
Beispiel #2
0
        private void Convert(double value)
        {
            switch (SelectedOp)
            {
            case "Length":
            {
                LengthunitConverter unit = new LengthunitConverter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }

            case "Mass and Weight":
            {
                MassConverter unit = new MassConverter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }

            case "Power":
            {
                PowerConverter unit = new PowerConverter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }

            case "Pressure":
            {
                PressureConverter unit = new PressureConverter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }

            case "Energy":
            {
                EnergyConveter unit = new EnergyConveter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }

            case "Temperature":
            {
                TemperatureConverter unit = new TemperatureConverter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }

            case "Volume":
            {
                VolumeConverter unit = new VolumeConverter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }

            case "Angle":
            {
                AngleConverter unit = new AngleConverter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }

            case "Area":
            {
                AreaConverter unit = new AreaConverter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }

            case "Speed":
            {
                SpeedConverter unit = new SpeedConverter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }

            case "Time":
            {
                TimeunitsConverter unit = new TimeunitsConverter();
                Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString();
                break;
            }
            }
        }