public void CreateSpeedSummaryResult_Should_return_null_object_When_CoverageArea_is_null() { var summarySpeedResult = new SpeedSummaryResult(1, 2, 3, 0); var machineSpeedTarget = new MachineSpeedTarget(5, 6); var result = new CompactionSpeedSummaryResult(summarySpeedResult, machineSpeedTarget); Assert.IsNotNull(result); Assert.AreEqual(ContractExecutionResult.DefaultMessage, result.Message); Assert.IsNull(result.SummaryData); }
public void CreateSpeedSummaryResult_Should_return_full_object_When_CoverageArea_is_not_null() { var summarySpeedResult = new SpeedSummaryResult(1, 2, 3, 8976.4); var machineSpeedTarget = new MachineSpeedTarget(4, 5); var result = new CompactionSpeedSummaryResult(summarySpeedResult, machineSpeedTarget); Assert.IsNotNull(result); Assert.AreEqual(ContractExecutionResult.DefaultMessage, result.Message); Assert.AreEqual(1, result.SummaryData.PercentGreaterThanTarget); Assert.AreEqual(2, result.SummaryData.PercentLessThanTarget); Assert.AreEqual(3, result.SummaryData.PercentEqualsTarget); Assert.AreEqual(8976.4, result.SummaryData.TotalAreaCoveredSqMeters); Assert.AreEqual(0.1, result.SummaryData.MinTargetMachineSpeed); Assert.AreEqual(0.2, result.SummaryData.MaxTargetMachineSpeed); }
/// <summary> /// Overload constructor with parameters. /// </summary> /// <param name="result">The speed results from Raptor</param> /// <param name="speedTarget">The speed target from Raptor</param> /// <returns>An instance of CompactionSpeedSummaryResult</returns> public CompactionSpeedSummaryResult(SpeedSummaryResult result, MachineSpeedTarget speedTarget) { if (result != null && result.HasData()) { SummaryData = new SpeedSummaryData { PercentEqualsTarget = result.MatchTarget, PercentGreaterThanTarget = result.AboveTarget, PercentLessThanTarget = result.BelowTarget, TotalAreaCoveredSqMeters = result.CoverageArea, MinTargetMachineSpeed = Math.Round(speedTarget.MinTargetMachineSpeed * CMSEC_TO_KMHOUR_CONVERSION_FACTOR, PRECISION, MidpointRounding.AwayFromZero), // cm per second converted to km per hour... MaxTargetMachineSpeed = Math.Round(speedTarget.MaxTargetMachineSpeed * CMSEC_TO_KMHOUR_CONVERSION_FACTOR, PRECISION, MidpointRounding.AwayFromZero) // cm per second converted to km per hour... }; } }
public void HasData_Should_return_expected_result_From_coverage_value(double coverageArea, bool expectedResult) { var obj = new SpeedSummaryResult(0, 0, 0, coverageArea); Assert.AreEqual(expectedResult, obj.HasData()); }