public void ClearAllCalculationOutput_FailureMechanismNull_ThrowsArgumentNullException() { // Call void Call() => GrassCoverErosionInwardsDataSynchronizationService.ClearAllCalculationOutput(null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("failureMechanism", exception.ParamName); }
public void ClearAllCalculationOutput_WithVariousCalculations_ClearsCalculationsOutputAndReturnsAffectedCalculations() { // Setup GrassCoverErosionInwardsFailureMechanism failureMechanism = CreateFullyConfiguredFailureMechanism(); ICalculation[] expectedAffectedCalculations = failureMechanism.Calculations .Where(c => c.HasOutput) .ToArray(); // Call IEnumerable <IObservable> affectedItems = GrassCoverErosionInwardsDataSynchronizationService.ClearAllCalculationOutput(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); }