public void FromString_ValidString_CorrectUnitSubType(string asString, QuantityMetric.MetricPrefix expectedMetricPrefix) { // Act var unitUnderTest = new VolumeMetric().FromString(asString); // Assert Assert.That(unitUnderTest.UnitSubType, Is.EqualTo((ushort)expectedMetricPrefix)); }
public void FromString_ValidString_CorrectUnitType(string asString) { // Act var unitUnderTest = new VolumeMetric().FromString(asString); // Assert Assert.That(unitUnderTest.UnitType, Is.EqualTo((ushort)Volume.VolumeUnit.Metric)); }
public void FromString_ValidString_CorrectQuantityType(string baseString) { // Act var unitUnderTest = new VolumeMetric().FromString(baseString); // Assert Assert.That(unitUnderTest.QuantityType, Is.EqualTo(QuantityType.Volume)); }
public void Constructor_InvalidDna_ThrowsException() { // Arrange var invalidDna = new QuantityDna { QuantityType = QuantityType.Length, UnitType = (ushort)Volume.VolumeUnit.Liter, UnitSubType = (ushort)QuantityMetric.MetricPrefix.Base, Precision = 2 }; // Act and Assert Assert.Throws <ArgumentException>(() => { var unused = new VolumeMetric(invalidDna, 21.09); }); }
public void Constructor_WithValidDna_CreatesVolumeMetric() { // Arrange var validDna = new QuantityDna { QuantityType = QuantityType.Volume, UnitType = (ushort)Volume.VolumeUnit.Metric, UnitSubType = (ushort)QuantityMetric.MetricPrefix.Base, Precision = 2 }; // Act var unitUnderTest = new VolumeMetric(validDna, 21.09); // Assert Assert.That(unitUnderTest.ToString(), Is.EqualTo("21,09m³")); }