Beispiel #1
0
        public void HasIllustrationPoints_WithVariousCalculationConfigurations_ReturnsExpectedResult(
            GrassCoverErosionInwardsCalculation calculation,
            bool expectedHasIllustrationPoints)
        {
            // Call
            bool hasIllustrationPoints = GrassCoverErosionInwardsIllustrationPointsHelper.HasIllustrationPoints(calculation);

            // Assert
            Assert.AreEqual(expectedHasIllustrationPoints, hasIllustrationPoints);
        }
Beispiel #2
0
        public void HasIllustrationPoints_CalculationNull_ThrowsArgumentNullException()
        {
            // Call
            TestDelegate call = () => GrassCoverErosionInwardsIllustrationPointsHelper.HasIllustrationPoints((GrassCoverErosionInwardsCalculation)null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(call);

            Assert.AreEqual("calculation", exception.ParamName);
        }
Beispiel #3
0
        public void HasIllustrationPoints_CalculationsNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => GrassCoverErosionInwardsIllustrationPointsHelper.HasIllustrationPoints((IEnumerable <GrassCoverErosionInwardsCalculation>)null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(Call);

            Assert.AreEqual("calculations", exception.ParamName);
        }
Beispiel #4
0
        public override bool ClearIllustrationPoints()
        {
            if (GrassCoverErosionInwardsIllustrationPointsHelper.HasIllustrationPoints(Calculation))
            {
                Calculation.ClearIllustrationPoints();
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Clears the illustration points of the provided grass cover erosion inwards calculations.
        /// </summary>
        /// <param name="calculations">The calculations for which the illustration points need to be cleared.</param>
        /// <returns>All objects changed during the clear.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculations"/> is <c>null</c>.</exception>
        public static IEnumerable <IObservable> ClearIllustrationPoints(IEnumerable <GrassCoverErosionInwardsCalculation> calculations)
        {
            if (calculations == null)
            {
                throw new ArgumentNullException(nameof(calculations));
            }

            var affectedObjects = new List <IObservable>();

            foreach (GrassCoverErosionInwardsCalculation calculation in calculations)
            {
                if (GrassCoverErosionInwardsIllustrationPointsHelper.HasIllustrationPoints(calculation))
                {
                    affectedObjects.Add(calculation);
                    calculation.ClearIllustrationPoints();
                }
            }

            return(affectedObjects);
        }