public void CreateDuneLocationFeatures_WithLocations_ReturnsLocationFeaturesCollection(bool withOutput) { // Setup DuneLocation[] duneLocations = { CreateDuneLocation(1), CreateDuneLocation(2) }; var failureMechanism = new DuneErosionFailureMechanism(); failureMechanism.DuneLocationCalculationsForUserDefinedTargetProbabilities.AddRange(new[] { new DuneLocationCalculationsForTargetProbability(0.1), new DuneLocationCalculationsForTargetProbability(0.001) }); failureMechanism.SetDuneLocations(duneLocations); if (withOutput) { DuneLocationsTestHelper.SetDuneLocationCalculationOutput(failureMechanism); } IEnumerable <AggregatedDuneLocation> aggregatedLocations = AggregatedDuneLocationFactory.CreateAggregatedDuneLocations( failureMechanism.DuneLocations, failureMechanism.DuneLocationCalculationsForUserDefinedTargetProbabilities); // Call IEnumerable <MapFeature> features = DuneErosionMapDataFeaturesFactory.CreateDuneLocationFeatures(aggregatedLocations); // Assert DuneErosionMapFeaturesTestHelper.AssertDuneLocationFeaturesData(failureMechanism, features); }
public void CreateDuneLocationFeatures_NoLocations_ReturnsEmptyFeaturesCollection() { // Call IEnumerable <MapFeature> features = DuneErosionMapDataFeaturesFactory.CreateDuneLocationFeatures(Enumerable.Empty <AggregatedDuneLocation>()); // Assert CollectionAssert.IsEmpty(features); }
public void CreateDuneLocationFeatures_LocationsNull_ThrowsArgumentNullException() { // Call void Call() => DuneErosionMapDataFeaturesFactory.CreateDuneLocationFeatures(null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("locations", exception.ParamName); }
private void SetFeatures() { DuneLocationCalculationsForTargetProbability[] orderedCalculationsForTargetProbabilities = failureMechanism.DuneLocationCalculationsForUserDefinedTargetProbabilities .OrderByDescending(tp => tp.TargetProbability) .ToArray(); IEnumerable <AggregatedDuneLocation> locations = AggregatedDuneLocationFactory.CreateAggregatedDuneLocations( failureMechanism.DuneLocations, orderedCalculationsForTargetProbabilities); MapData.Features = DuneErosionMapDataFeaturesFactory.CreateDuneLocationFeatures(locations); if (MapData.Features.Any()) { UpdateMetaData(orderedCalculationsForTargetProbabilities); } }