public void CreateCalculationActivitiesForFailureMechanism_WithValidCalculations_ReturnsGrassCoverErosionInwardsCalculationActivitiesWithParametersSet()
        {
            // Setup
            var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();

            var mocks = new MockRepository();
            IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism,
                                                                                                           mocks,
                                                                                                           validFilePath);

            mocks.ReplayAll();

            GrassCoverErosionInwardsCalculation calculation1 = CreateValidCalculation();
            GrassCoverErosionInwardsCalculation calculation2 = CreateValidCalculation();

            failureMechanism.CalculationsGroup.Children.AddRange(new[]
            {
                calculation1,
                calculation2
            });

            // Call
            IEnumerable <CalculatableActivity> activities = GrassCoverErosionInwardsCalculationActivityFactory.CreateCalculationActivities(
                failureMechanism, assessmentSection);

            // Assert
            CollectionAssert.AllItemsAreInstancesOfType(activities, typeof(GrassCoverErosionInwardsCalculationActivity));
            Assert.AreEqual(2, activities.Count());

            HydraulicBoundaryDatabase hydraulicBoundaryDatabase = assessmentSection.HydraulicBoundaryDatabase;

            AssertGrassCoverErosionInwardsCalculationActivity(activities.First(), calculation1, hydraulicBoundaryDatabase);
            AssertGrassCoverErosionInwardsCalculationActivity(activities.ElementAt(1), calculation2, hydraulicBoundaryDatabase);
            mocks.VerifyAll();
        }
        /// <summary>
        /// Creates a collection of <see cref="CalculatableActivity"/> for all relevant calculations
        /// in the given <see cref="AssessmentSection"/>.
        /// </summary>
        /// <param name="assessmentSection">The assessment section to create the activities for.</param>
        /// <returns>A collection of <see cref="CalculatableActivity"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="assessmentSection"/> is <c>null</c>.</exception>
        public static IEnumerable <CalculatableActivity> CreateCalculationActivities(AssessmentSection assessmentSection)
        {
            if (assessmentSection == null)
            {
                throw new ArgumentNullException(nameof(assessmentSection));
            }

            var activities = new List <CalculatableActivity>();

            activities.AddRange(PipingCalculationActivityFactory.CreateCalculationActivities(
                                    assessmentSection.Piping,
                                    assessmentSection));
            activities.AddRange(GrassCoverErosionInwardsCalculationActivityFactory.CreateCalculationActivities(
                                    assessmentSection.GrassCoverErosionInwards,
                                    assessmentSection));
            activities.AddRange(MacroStabilityInwardsCalculationActivityFactory.CreateCalculationActivities(
                                    assessmentSection.MacroStabilityInwards,
                                    assessmentSection));
            activities.AddRange(HeightStructuresCalculationActivityFactory.CreateCalculationActivities(
                                    assessmentSection.HeightStructures,
                                    assessmentSection));
            activities.AddRange(ClosingStructuresCalculationActivityFactory.CreateCalculationActivities(
                                    assessmentSection.ClosingStructures,
                                    assessmentSection));
            activities.AddRange(StabilityPointStructuresCalculationActivityFactory.CreateCalculationActivities(
                                    assessmentSection.StabilityPointStructures,
                                    assessmentSection));

            return(activities);
        }
        public void CreateCalculationActivitiesForFailureMechanism_AssessmentSectionNull_ThrowsArgumentNullException()
        {
            // Call
            TestDelegate test = () => GrassCoverErosionInwardsCalculationActivityFactory.CreateCalculationActivities(new GrassCoverErosionInwardsFailureMechanism(), null);

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

            Assert.AreEqual("assessmentSection", exception.ParamName);
        }
        public void CreateCalculationActivitiesForFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            // Call
            TestDelegate test = () => GrassCoverErosionInwardsCalculationActivityFactory.CreateCalculationActivities(null, assessmentSection);

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

            Assert.AreEqual("failureMechanism", exception.ParamName);
            mocks.VerifyAll();
        }