Skip to content

Commit

Permalink
Merge pull request #164 from eriove/feature/minandmaxvalue
Browse files Browse the repository at this point in the history
Add Min and MaxValue to unit classes
  • Loading branch information
angularsen committed Apr 21, 2016
2 parents 49101e8 + 9fb952b commit 8d06bbc
Show file tree
Hide file tree
Showing 39 changed files with 838 additions and 0 deletions.
12 changes: 12 additions & 0 deletions UnitsNet.Tests/CustomCode/InformationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,17 @@ public void OneKBHas1000Bytes()
{
Assert.AreEqual(1000, Information.FromKilobytes(1).Bytes);
}

[Test]
public void MaxValueIsCorrectForUnitWithBaseTypeDecimal()
{
Assert.AreEqual(decimal.MaxValue, Information.MaxValue.Bits);
}

[Test]
public void MinValueIsCorrectForUnitWithBaseTypeDecimal()
{
Assert.AreEqual(decimal.MinValue, Information.MinValue.Bits);
}
}
}
12 changes: 12 additions & 0 deletions UnitsNet.Tests/CustomCode/LengthTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,17 @@ public void ToStringReturnsCorrectNumberAndUnitWithCentimeterAsDefualtUnit()
Length.ToStringDefaultUnit = oldUnit;
Assert.AreEqual("2 cm", valueString);
}

[Test]
public void MaxValueIsCorrectForUnitWithBaseTypeDouble()
{
Assert.AreEqual(double.MaxValue, Length.MaxValue.Meters);
}

[Test]
public void MinValueIsCorrectForUnitWithBaseTypeDouble()
{
Assert.AreEqual(double.MinValue, Length.MinValue.Meters);
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/Acceleration.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -828,5 +828,27 @@ public string ToString(AccelerationUnit unit, [CanBeNull] Culture culture, [NotN
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of Acceleration
/// </summary>
public static Acceleration MaxValue
{
get
{
return new Acceleration(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of Acceleration
/// </summary>
public static Acceleration MinValue
{
get
{
return new Acceleration(double.MinValue);
}
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/AmplitudeRatio.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -688,5 +688,27 @@ public string ToString(AmplitudeRatioUnit unit, [CanBeNull] Culture culture, [No
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of AmplitudeRatio
/// </summary>
public static AmplitudeRatio MaxValue
{
get
{
return new AmplitudeRatio(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of AmplitudeRatio
/// </summary>
public static AmplitudeRatio MinValue
{
get
{
return new AmplitudeRatio(double.MinValue);
}
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/Angle.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,5 +1050,27 @@ public string ToString(AngleUnit unit, [CanBeNull] Culture culture, [NotNull] st
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of Angle
/// </summary>
public static Angle MaxValue
{
get
{
return new Angle(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of Angle
/// </summary>
public static Angle MinValue
{
get
{
return new Angle(double.MinValue);
}
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/Area.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -939,5 +939,27 @@ public string ToString(AreaUnit unit, [CanBeNull] Culture culture, [NotNull] str
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of Area
/// </summary>
public static Area MaxValue
{
get
{
return new Area(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of Area
/// </summary>
public static Area MinValue
{
get
{
return new Area(double.MinValue);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -680,5 +680,27 @@ public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] Cultur
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of BrakeSpecificFuelConsumption
/// </summary>
public static BrakeSpecificFuelConsumption MaxValue
{
get
{
return new BrakeSpecificFuelConsumption(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of BrakeSpecificFuelConsumption
/// </summary>
public static BrakeSpecificFuelConsumption MinValue
{
get
{
return new BrakeSpecificFuelConsumption(double.MinValue);
}
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/Density.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -939,5 +939,27 @@ public string ToString(DensityUnit unit, [CanBeNull] Culture culture, [NotNull]
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of Density
/// </summary>
public static Density MaxValue
{
get
{
return new Density(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of Density
/// </summary>
public static Density MinValue
{
get
{
return new Density(double.MinValue);
}
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/Duration.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -939,5 +939,27 @@ public string ToString(DurationUnit unit, [CanBeNull] Culture culture, [NotNull]
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of Duration
/// </summary>
public static Duration MaxValue
{
get
{
return new Duration(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of Duration
/// </summary>
public static Duration MinValue
{
get
{
return new Duration(double.MinValue);
}
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/DynamicViscosity.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -754,5 +754,27 @@ public string ToString(DynamicViscosityUnit unit, [CanBeNull] Culture culture, [
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of DynamicViscosity
/// </summary>
public static DynamicViscosity MaxValue
{
get
{
return new DynamicViscosity(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of DynamicViscosity
/// </summary>
public static DynamicViscosity MinValue
{
get
{
return new DynamicViscosity(double.MinValue);
}
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/ElectricCurrent.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -791,5 +791,27 @@ public string ToString(ElectricCurrentUnit unit, [CanBeNull] Culture culture, [N
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of ElectricCurrent
/// </summary>
public static ElectricCurrent MaxValue
{
get
{
return new ElectricCurrent(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of ElectricCurrent
/// </summary>
public static ElectricCurrent MinValue
{
get
{
return new ElectricCurrent(double.MinValue);
}
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/ElectricPotential.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -754,5 +754,27 @@ public string ToString(ElectricPotentialUnit unit, [CanBeNull] Culture culture,
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of ElectricPotential
/// </summary>
public static ElectricPotential MaxValue
{
get
{
return new ElectricPotential(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of ElectricPotential
/// </summary>
public static ElectricPotential MinValue
{
get
{
return new ElectricPotential(double.MinValue);
}
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/ElectricResistance.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -680,5 +680,27 @@ public string ToString(ElectricResistanceUnit unit, [CanBeNull] Culture culture,
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of ElectricResistance
/// </summary>
public static ElectricResistance MaxValue
{
get
{
return new ElectricResistance(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of ElectricResistance
/// </summary>
public static ElectricResistance MinValue
{
get
{
return new ElectricResistance(double.MinValue);
}
}
}
}
22 changes: 22 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,5 +1050,27 @@ public string ToString(EnergyUnit unit, [CanBeNull] Culture culture, [NotNull] s
object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
return string.Format(formatProvider, format, formatArgs);
}

/// <summary>
/// Represents the largest possible value of Energy
/// </summary>
public static Energy MaxValue
{
get
{
return new Energy(double.MaxValue);
}
}

/// <summary>
/// Represents the smallest possible value of Energy
/// </summary>
public static Energy MinValue
{
get
{
return new Energy(double.MinValue);
}
}
}
}
Loading

2 comments on commit 8d06bbc

@angularsen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Units.NET :: Master Build 40 is now running

@angularsen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Units.NET :: Master Build 40 outcome was SUCCESS
Summary: Tests passed: 803 Build time: 0:0:34

Please sign in to comment.