public void ChangeComposition_ToTargetValue_UpdateFailureMechanismInAssemblyStates(AssessmentSectionComposition composition, bool[] inAssemblyStates) { // Setup AssessmentSectionComposition initialComposition = composition == AssessmentSectionComposition.Dike ? AssessmentSectionComposition.Dune : AssessmentSectionComposition.Dike; var assessmentSection = new AssessmentSection(initialComposition); // Precondition Assert.AreNotEqual(assessmentSection.Composition, composition); // Call assessmentSection.ChangeComposition(composition); // Assert Assert.AreEqual(inAssemblyStates[0], assessmentSection.Piping.InAssembly); Assert.AreEqual(inAssemblyStates[1], assessmentSection.GrassCoverErosionInwards.InAssembly); Assert.AreEqual(inAssemblyStates[2], assessmentSection.MacroStabilityInwards.InAssembly); Assert.AreEqual(inAssemblyStates[3], assessmentSection.StabilityStoneCover.InAssembly); Assert.AreEqual(inAssemblyStates[4], assessmentSection.WaveImpactAsphaltCover.InAssembly); Assert.AreEqual(inAssemblyStates[5], assessmentSection.GrassCoverErosionOutwards.InAssembly); Assert.AreEqual(inAssemblyStates[6], assessmentSection.HeightStructures.InAssembly); Assert.AreEqual(inAssemblyStates[7], assessmentSection.ClosingStructures.InAssembly); Assert.AreEqual(inAssemblyStates[8], assessmentSection.StabilityPointStructures.InAssembly); Assert.AreEqual(inAssemblyStates[9], assessmentSection.PipingStructure.InAssembly); Assert.AreEqual(inAssemblyStates[10], assessmentSection.DuneErosion.InAssembly); }
public void ChangeComposition_InvalidAssessmentSectionComposition_ThrowsInvalidEnumArgumentException() { // Setup const int invalidValue = 99; var random = new Random(21); var assessmentSection = new AssessmentSection(random.NextEnumValue <AssessmentSectionComposition>()); // Call void Call() => assessmentSection.ChangeComposition((AssessmentSectionComposition)invalidValue); // Assert var expectedMessage = $"The value of argument 'newComposition' ({invalidValue}) is invalid for Enum type '{nameof(AssessmentSectionComposition)}'."; string parameterName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(Call, expectedMessage).ParamName; Assert.AreEqual("newComposition", parameterName); }