public void CreateFailureMechanismSectionAssemblyGroupBoundaries_InterpretationCategoriesNull_ThrowsArgumentNullException() { // Call void Call() => FailureMechanismSectionAssemblyGroupCreator.CreateFailureMechanismSectionAssemblyGroupBoundaries(null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("interpretationCategories", exception.ParamName); }
public void CreateFailureMechanismSectionAssemblyGroupBoundaries_InvalidInterpretationCategory_ThrowsInvalidEnumArgumentException() { // Setup var groups = new CategoriesList <InterpretationCategory>(new[] { new InterpretationCategory((EInterpretationCategory)99, new Probability(0), new Probability(1)) }); // Call void Call() => FailureMechanismSectionAssemblyGroupCreator.CreateFailureMechanismSectionAssemblyGroupBoundaries(groups); // Assert var exceptionMessage = $"The value of argument 'interpretationCategory' (99) is invalid for Enum type '{nameof(EInterpretationCategory)}'."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(Call, exceptionMessage); }
public void CreateFailureMechanismSectionAssemblyGroupBoundaries_WithValidInterpretationCategories_ReturnsExpectedFailureMechanismSectionAssemblyGroups() { // Setup var random = new Random(11); var groups = new CategoriesList <InterpretationCategory>(new[] { new InterpretationCategory(random.NextEnumValue <EInterpretationCategory>(), new Probability(0), new Probability(0.25)), new InterpretationCategory(random.NextEnumValue <EInterpretationCategory>(), new Probability(0.25), new Probability(0.5)), new InterpretationCategory(random.NextEnumValue <EInterpretationCategory>(), new Probability(0.5), new Probability(0.75)), new InterpretationCategory(random.NextEnumValue <EInterpretationCategory>(), new Probability(0.75), new Probability(1)) }); // Call IEnumerable <FailureMechanismSectionAssemblyGroupBoundaries> assemblyGroups = FailureMechanismSectionAssemblyGroupCreator.CreateFailureMechanismSectionAssemblyGroupBoundaries(groups); // Assert FailureMechanismSectionAssemblyGroupBoundariesAssert.AssertFailureMechanismSectionAssemblyGroupBoundaries(groups, assemblyGroups); }
public IEnumerable <FailureMechanismSectionAssemblyGroupBoundaries> CalculateFailureMechanismSectionAssemblyGroupBoundaries( double signalFloodingProbability, double maximumAllowableFloodingProbability) { try { ICategoryLimitsCalculator kernel = factory.CreateAssemblyGroupsKernel(); CategoriesList <InterpretationCategory> interpretationCategories = kernel.CalculateInterpretationCategoryLimitsBoi01( new AssessmentSection(AssemblyCalculatorInputCreator.CreateProbability(signalFloodingProbability), AssemblyCalculatorInputCreator.CreateProbability(maximumAllowableFloodingProbability))); return(FailureMechanismSectionAssemblyGroupCreator.CreateFailureMechanismSectionAssemblyGroupBoundaries(interpretationCategories)); } catch (AssemblyException e) { throw new FailureMechanismSectionAssemblyGroupBoundariesCalculatorException(AssemblyErrorMessageCreator.CreateErrorMessage(e.Errors), e); } catch (Exception e) { throw new FailureMechanismSectionAssemblyGroupBoundariesCalculatorException(AssemblyErrorMessageCreator.CreateGenericErrorMessage(), e); } }