public void ClearDuneLocationCalculationsOutput_CalculationsNull_ThrowsArgumentNullException() { // Call void Call() => DuneErosionDataSynchronizationService.ClearDuneLocationCalculationsOutput((IEnumerable <DuneLocationCalculation>)null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("calculations", exception.ParamName); }
public void ClearDuneLocationCalculationOutput_FailureMechanismNull_ThrowsArgumentNullException() { // Call void Call() => DuneErosionDataSynchronizationService.ClearDuneLocationCalculationsOutput((DuneErosionFailureMechanism)null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("failureMechanism", exception.ParamName); }
private IEnumerable <IObservable> ClearDuneLocationCalculationOutput() { IEnumerable <IObservable> affectedObjects = DuneErosionDataSynchronizationService.ClearDuneLocationCalculationsOutput(calculationsForTargetProbability.DuneLocationCalculations); if (affectedObjects.Any()) { log.Info(RiskeerCommonPluginResources.TargetProbabilityChangeHandler_Hydraulic_load_results_cleared); return(affectedObjects); } return(Enumerable.Empty <IObservable>()); }
public void ClearDuneLocationCalculationsOutput_CalculationsWithOutput_OutputClearedAndAffectedItemsReturned() { // Setup var duneLocationCalculationWithOutput1 = new DuneLocationCalculation(new TestDuneLocation()) { Output = new TestDuneLocationCalculationOutput() }; var duneLocationCalculationWithOutput2 = new DuneLocationCalculation(new TestDuneLocation()) { Output = new TestDuneLocationCalculationOutput() }; DuneLocationCalculation[] calculations = { new DuneLocationCalculation(new TestDuneLocation()), duneLocationCalculationWithOutput1, new DuneLocationCalculation(new TestDuneLocation()), duneLocationCalculationWithOutput2, new DuneLocationCalculation(new TestDuneLocation()) }; IEnumerable <IObservable> expectedAffectedCalculations = new[] { duneLocationCalculationWithOutput1, duneLocationCalculationWithOutput2 }; // Call IEnumerable <IObservable> affected = DuneErosionDataSynchronizationService.ClearDuneLocationCalculationsOutput(calculations); // Assert CollectionAssert.AreEquivalent(expectedAffectedCalculations, affected); Assert.IsNull(duneLocationCalculationWithOutput1.Output); Assert.IsNull(duneLocationCalculationWithOutput2.Output); }
public void ClearDuneLocationCalculationOutput_CalculationsWithOutput_OutputClearedAndAffectedItemsReturned() { // Setup var duneLocations = new[] { new TestDuneLocation(), new TestDuneLocation() }; var duneLocationCalculationsForTargetProbability1 = new DuneLocationCalculationsForTargetProbability(0.1); var duneLocationCalculationsForTargetProbability2 = new DuneLocationCalculationsForTargetProbability(0.01); var failureMechanism = new DuneErosionFailureMechanism { DuneLocationCalculationsForUserDefinedTargetProbabilities = { duneLocationCalculationsForTargetProbability1, duneLocationCalculationsForTargetProbability2 } }; failureMechanism.SetDuneLocations(duneLocations); duneLocationCalculationsForTargetProbability1.DuneLocationCalculations.First().Output = new TestDuneLocationCalculationOutput(); duneLocationCalculationsForTargetProbability2.DuneLocationCalculations.First().Output = new TestDuneLocationCalculationOutput(); IEnumerable <IObservable> expectedAffectedCalculations = DuneLocationsTestHelper.GetAllDuneLocationCalculationsWithOutput(failureMechanism); // Call IEnumerable <IObservable> affected = DuneErosionDataSynchronizationService.ClearDuneLocationCalculationsOutput(failureMechanism); // Assert CollectionAssert.AreEquivalent(expectedAffectedCalculations, affected); DuneLocationsTestHelper.AssertDuneLocationCalculationsHaveNoOutputs(failureMechanism); }