public void GivenQuantity_WhenFeetRefCompareWithSameFeetRef_ShouldReturnTrue() { QuantityUnits unit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.FEET), 0); bool result = this.quantityMeasurement.EqualtyCheck(unit, unit); Assert.IsTrue(result); }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 21, Configuration.FieldSeparator), Id, SubstanceIdentifier?.ToDelimitedString(), SubstanceStatus != null ? string.Join(Configuration.FieldRepeatSeparator, SubstanceStatus.Select(x => x.ToDelimitedString())) : null, SubstanceType?.ToDelimitedString(), InventoryContainerIdentifier?.ToDelimitedString(), ContainerCarrierIdentifier?.ToDelimitedString(), PositionOnCarrier?.ToDelimitedString(), InitialQuantity.HasValue ? InitialQuantity.Value.ToString(Consts.NumericFormat, culture) : null, CurrentQuantity.HasValue ? CurrentQuantity.Value.ToString(Consts.NumericFormat, culture) : null, AvailableQuantity.HasValue ? AvailableQuantity.Value.ToString(Consts.NumericFormat, culture) : null, ConsumptionQuantity.HasValue ? ConsumptionQuantity.Value.ToString(Consts.NumericFormat, culture) : null, QuantityUnits?.ToDelimitedString(), ExpirationDateTime.HasValue ? ExpirationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, FirstUsedDateTime.HasValue ? FirstUsedDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, OnBoardStabilityDuration, TestFluidIdentifiers != null ? string.Join(Configuration.FieldRepeatSeparator, TestFluidIdentifiers.Select(x => x.ToDelimitedString())) : null, ManufacturerLotNumber, ManufacturerIdentifier?.ToDelimitedString(), SupplierIdentifier?.ToDelimitedString(), OnBoardStabilityTime?.ToDelimitedString(), TargetValue?.ToDelimitedString() ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public void GivenQuantity_WhenOneTonneValueCompareWithThousandKGValue_ShouldReturnTrue() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.TONNE), 1); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.KG), 1000); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, secondUnit); Assert.IsTrue(result); }
public void GivenQuantity_WhenTenFeetValueCompareWithZeroFeetValue_ShouldReturnFalse() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.FEET), 10); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.FEET), 0); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, secondUnit); Assert.IsFalse(result); }
public void GivenQuantity_WhenOneGallonValueCompareWithThreePointSeventyEightLitreValue_ShouldReturnTrue() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.GALLON), 1); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.LITRE), 3.78); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, secondUnit); Assert.IsTrue(result); }
public void GivenQuantity_WhenZeroInchCompareWithZeroInch_ThenReturnTrue() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.INCH), 0); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.INCH), 0); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, secondUnit); Assert.IsTrue(result); }
public void WhenInchesRefference_comparetosameInchesRefference_ShouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), 0); bool result = quantityMeasurement.EqualityCheck(firstUnit, firstUnit); Assert.IsTrue(result); }
public void GivenQuantity_WhenTwoInchValueCompareWithFiveCMValue_ShouldReturnTrue() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.INCH), 2); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.CM), 5); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, secondUnit); Assert.IsTrue(result); }
public void GivenQuantity_WhenOneYardValueCompareWithThreeFeetValue_ShouldReturnTrue() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.YARD), 1); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.FEET), 3); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, secondUnit); Assert.IsTrue(result); }
public void GivenQuantity_WhenUnitIsNegative_ThenThrowException() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.FEET), -1); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.FEET), -1); var result = Assert.Throws <QuantityMeasurementException>(() => this.quantityMeasurement.EqualtyCheck(firstUnit, secondUnit)); Assert.AreEqual(QuantityMeasurementException.ExceptionType.VALUE_MUST_BE_POSITIVE, result.exceptionType); }
public void GiventhirtySixInches_OneYardand_WhenCompare_ShouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), 36); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.YARD), 1); bool result = quantityMeasurement.EqualityCheck(firstUnit, SecondUnit); Assert.IsTrue(result); }
public void WhenGivenQuantittyCompareWithFeetType_shouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.FEET), 0); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.FEET), 0); bool result = quantityMeasurement.EqualityCheck(firstUnit, SecondUnit); Assert.IsTrue(result); }
public void WhenfiveFeetComparedWith_twoFeet_ShouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.FEET), 5); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.FEET), 2); bool result = quantityMeasurement.EqualityCheck(firstUnit, SecondUnit); Assert.IsFalse(result); }
public void GivenOneGallon_andthreeLitre_WhenCompare_ShouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.GALLON), 1); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.LITRE), 3.78); bool result = quantityMeasurement.EqualityCheck(firstUnit, SecondUnit); Assert.IsTrue(result); }
public void GivenTwoInches_andFiveCM_WhenCompare_ShouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), 2); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.CM), 5); bool result = quantityMeasurement.EqualityCheck(firstUnit, SecondUnit); Assert.IsTrue(result); }
public void GivenZeroInchesCompareWithNull_ShouldReturnFalse() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), 0); QuantityUnits secondUnit = null; bool result = quantityMeasurement.EqualityCheck(firstUnit, secondUnit); Assert.IsFalse(result); }
public void GivenQuantity_WhenZerofeetCompareWithZeroFeet_ThenReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.FEET), 0); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.FEET), 0); bool result = quantityMeasurement.EqualityCheck(firstUnit, secondUnit); Assert.IsTrue(result); }
public void GivenOneFeetand_OneYard_WhenCompare_ShouldReturnFalse() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.FEET), 1); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.YARD), 1); bool result = quantityMeasurement.EqualityCheck(firstUnit, SecondUnit); Assert.False(result); }
public void WhenTwoInches_comparedWithZero_ShouldReturnFalse() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), 2); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), 0); bool result = quantityMeasurement.EqualityCheck(firstUnit, SecondUnit); Assert.IsFalse(result); }
public void GivenFAHRNEEITandCELSIUS_WhenCompare_ShouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.FAHRNEEIT), 212); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.CELSIUS), 100); bool result = quantityMeasurement.EqualityCheck(firstUnit, SecondUnit); Assert.IsTrue(result); }
public void GivenOneTonne_andthousandKG_WhenCompare_ShouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.TONNE), 1); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.KG), 1000); bool result = quantityMeasurement.EqualityCheck(firstUnit, SecondUnit); Assert.IsTrue(result); }
public ReportedDisturbance(Phase phase, DateTime time, double max, double min, double avg, TimeSpan duration, QuantityUnits units) { Phase = phase; Time = time; Maximum = max; Minimum = min; Average = avg; Duration = duration; Units = units; }
public void GivenQuantity_WhenTwoHundredTwelveFahrenheitValueCompareWithHundredCelsiusValue_ShouldReturnTrue() { double firstTemperatureUnit = this.quantityMeasurement.TemperatureConversion(UnitConversion.Units.CELSIUS, 100); double secondTemperatureUnit = this.quantityMeasurement.TemperatureConversion(UnitConversion.Units.FAHRENHEIT, 212); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.CELSIUS), firstTemperatureUnit); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.FAHRENHEIT), secondTemperatureUnit); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, secondUnit); Assert.IsTrue(result); }
public void GivenQuantity_WhenTwentyFourInchValueCompareWithAdditionOfOneFeetAndOneFeetValue_ShouldReturnTrue() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.INCH), 24); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.FEET), 1); QuantityUnits thirdUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.FEET), 1); double additionOfUnits = this.quantityMeasurement.AddQuantityUnits(thirdUnit, secondUnit); QuantityUnits newAdditionUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.INCH), additionOfUnits); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, newAdditionUnit); Assert.IsTrue(result); }
public void GivenQuantity_WhenSevenPointFiftySixLitreValueCompareWithAdditionOfOneGallonAndThousandLitreValue_ShouldReturnTrue() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.LITRE), 2); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.ML), 1000); QuantityUnits thirdUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.LITRE), 1); double additionOfUnits = this.quantityMeasurement.AddQuantityUnits(thirdUnit, secondUnit); QuantityUnits newAdditionUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.LITRE), additionOfUnits); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, newAdditionUnit); Assert.IsTrue(result); }
public void GivenQuantity_WhenThreeInchValueCompareWithAdditionOfTwoInchAndTwoPointFiveValue_ShouldReturnTrue() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.INCH), 3); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.INCH), 2); QuantityUnits thirdUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.CM), 2.5); double additionOfUnits = this.quantityMeasurement.AddQuantityUnits(thirdUnit, secondUnit); QuantityUnits newAdditionUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.INCH), additionOfUnits); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, newAdditionUnit); Assert.IsTrue(result); }
public void GivenQuantity_WhenOneThousandOneKGValueCompareWithAdditionOfOneTonneAndThousandGMValue_ShouldReturnTrue() { QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.KG), 1001); QuantityUnits secondUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.TONNE), 1); QuantityUnits thirdUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.GM), 1000); double additionOfUnits = this.quantityMeasurement.AddQuantityUnits(thirdUnit, secondUnit); QuantityUnits newAdditionUnit = new QuantityUnits((double)UnitConversion.GetQuantityValue(UnitConversion.Units.LITRE), additionOfUnits); bool result = this.quantityMeasurement.EqualtyCheck(firstUnit, newAdditionUnit); Assert.IsTrue(result); }
public void GivenAdditionofOneFeetAndOneFeet_ComparedWithTweentyFourInches_ShouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.FEET), 1); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.FEET), 1); QuantityUnits Addition = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), 24); double AdditionOfUnit = quantityMeasurement.AddQuntities(firstUnit, SecondUnit); QuantityUnits newAdditionUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), AdditionOfUnit); bool result = quantityMeasurement.EqualityCheck(Addition, newAdditionUnit); Assert.IsTrue(result); }
public void GivenAdditionofTwoInchesAndtwocm_ComparedWithThreeInches_ShouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), 2); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.CM), 2.5); QuantityUnits Addition = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), 3); double AdditionOfUnit = quantityMeasurement.AddQuntities(firstUnit, SecondUnit); QuantityUnits newAdditionUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.INCH), AdditionOfUnit); bool result = quantityMeasurement.EqualityCheck(Addition, newAdditionUnit); Assert.IsTrue(result); }
public void GivenAdditionof_TwoQuantities_ComparedWithGivenAdditionInKG_ShouldReturnTrue() { QuantityMeasurement quantityMeasurement = new QuantityMeasurement(); QuantityUnits firstUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.TONNE), 1); QuantityUnits SecondUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.GM), 1000); QuantityUnits Addition = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.KG), 1001); double AdditionOfUnit = quantityMeasurement.AddQuntities(firstUnit, SecondUnit); QuantityUnits newAdditionUnit = new QuantityUnits((double)UnitConversion.GetQuanityValue(UnitConversion.Units.KG), AdditionOfUnit); bool result = quantityMeasurement.EqualityCheck(Addition, newAdditionUnit); Assert.IsTrue(result); }