public void ClearAllWaveConditionsCalculationOutput_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => StabilityStoneCoverDataSynchronizationService.ClearAllWaveConditionsCalculationOutput(null); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("failureMechanism", exception.ParamName); }
public void ClearAllWaveConditionsCalculationOutput_CalculationWithoutOutput_ReturnNoAffectedCalculations() { // Setup var failureMechanism = new StabilityStoneCoverFailureMechanism(); failureMechanism.CalculationsGroup.Children.Add(new StabilityStoneCoverWaveConditionsCalculation()); // Call IEnumerable <IObservable> affectedItems = StabilityStoneCoverDataSynchronizationService.ClearAllWaveConditionsCalculationOutput(failureMechanism); // Assert CollectionAssert.IsEmpty(affectedItems); }
public void ClearAllWaveConditionsCalculationOutput_WithVariousCalculations_ClearsCalculationsOutputAndReturnsAffectedCalculations() { // Setup StabilityStoneCoverFailureMechanism failureMechanism = CreateFullyConfiguredFailureMechanism(); ICalculation[] expectedAffectedCalculations = failureMechanism.Calculations .Where(c => c.HasOutput) .ToArray(); // Call IEnumerable <IObservable> affectedItems = StabilityStoneCoverDataSynchronizationService.ClearAllWaveConditionsCalculationOutput(failureMechanism); // Assert // Note: To make sure the clear is performed regardless of what is done with // the return result, no ToArray() should be called before these assertions: Assert.IsTrue(failureMechanism.Calculations.All(c => !c.HasOutput)); CollectionAssert.AreEquivalent(expectedAffectedCalculations, affectedItems); }