public Dimension(decimal?height, decimal?width, decimal?depth, DimensionUnitOfMeasure unitOfMeasure) { Height = height; Width = width; Depth = depth; UnitOfMeasure = unitOfMeasure; }
private decimal?GetInMillimeter(decimal?value, DimensionUnitOfMeasure uom) { if (uom == DimensionUnitOfMeasure.None) { return(null); } switch (uom) { case DimensionUnitOfMeasure.Millimeter: return(value); case DimensionUnitOfMeasure.CentiMeter: return(value * 10); case DimensionUnitOfMeasure.Meter: return(value * 1000); case DimensionUnitOfMeasure.Inches: return(value * 2.54M * 10); case DimensionUnitOfMeasure.Feet: return(value * 12 * 2.54M * 10); default: return(null); } }
//[InlineData("3 m cable", null, null, null, "null")] public void ParseDimensionDebug(string input, decimal height, decimal width, decimal depth, DimensionUnitOfMeasure uom) { var dim = DetailValueParser.ParseDimensions(input); dim.UnitOfMeasure.Should().Be(uom); dim.Height.Should().Be(height); dim.Width.Should().Be(width); dim.Depth.Should().Be(depth); }