public void ConstructorPassessValidValuesToPropertiesCorrectly(double lowerBoundaryStandardValue, double signalingStandardValue) { var input = new CalculateAssessmentSectionCategoriesInput((Probability)signalingStandardValue, (Probability)lowerBoundaryStandardValue); Assert.AreEqual(signalingStandardValue, input.SignalingStandard.Value); Assert.AreEqual(lowerBoundaryStandardValue, input.LowerBoundaryStandard.Value); }
public void ConstructorValidatesValidStandardsWrongBoundaries() { var signalingStandard = (Probability)(1.0 / 1000); var lowerBoundaryStandard = (Probability)(1.0 / 3000); void TestDelegate() { var input = new CalculateAssessmentSectionCategoriesInput(signalingStandard, lowerBoundaryStandard); } Assert.Throws <AssemblyToolKernelException>(TestDelegate, ErrorCode.SignallingStandardExceedsLowerBoundary.GetMessage()); }
public void CalculateAssessmentSectionCategoriesTest(double signalingStandard, double lowerBoundaryStandard) { var input = new CalculateAssessmentSectionCategoriesInput((Probability)signalingStandard, (Probability)lowerBoundaryStandard); var calculationResult = new CategoriesCalculator().CalculateAssessmentSectionCategories(input); Assert.IsNotNull(calculationResult.Result); Assert.IsNotNull(calculationResult.WarningMessages); Assert.IsEmpty(calculationResult.WarningMessages); var result = calculationResult.Result; Assert.AreEqual(5, result.Length); var firstCategory = result[0]; Assert.AreEqual(AssessmentSectionCategoryGroup.APlus, firstCategory.CategoryGroup); Assert.AreEqual(0, firstCategory.LowerBoundary, 1e-8); Assert.AreEqual(1 / 30.0 * signalingStandard, firstCategory.UpperBoundary, 1e-8); var category2 = result[1]; Assert.AreEqual(AssessmentSectionCategoryGroup.A, category2.CategoryGroup); Assert.AreEqual(1 / 30.0 * signalingStandard, category2.LowerBoundary, 1e-8); Assert.AreEqual(signalingStandard, category2.UpperBoundary, 1e-8); var category3 = result[2]; Assert.AreEqual(AssessmentSectionCategoryGroup.B, category3.CategoryGroup); Assert.AreEqual(signalingStandard, category3.LowerBoundary, 1e-8); Assert.AreEqual(lowerBoundaryStandard, category3.UpperBoundary, 1e-8); var category4 = result[3]; Assert.AreEqual(AssessmentSectionCategoryGroup.C, category4.CategoryGroup); Assert.AreEqual(lowerBoundaryStandard, category4.LowerBoundary, 1e-8); Assert.AreEqual(30.0 * lowerBoundaryStandard, category4.UpperBoundary, 1e-8); var category5 = result[4]; Assert.AreEqual(AssessmentSectionCategoryGroup.D, category5.CategoryGroup); Assert.AreEqual(30.0 * lowerBoundaryStandard, category5.LowerBoundary, 1e-8); Assert.AreEqual(1, category5.UpperBoundary, 1e-8); }
/// <summary> /// Calculates category boundaries (probabilities) for usages in assembly of WBI2017 assessment results on assessment section level. /// This method implements "WBI-2-1" from the Functional Design. /// </summary> /// <param name="input">The input for this method, consisting of an signaling standard and a lower boundary standard.</param> /// <returns>A collection of <see cref="AssessmentSectionCategory"/> that contains all assembly categories with their boundaries.</returns> /// <exception cref="AssemblyToolKernelException">Thrown when inconsistent boundaries were derived.</exception> public CalculationOutput <AssessmentSectionCategory[]> CalculateAssessmentSectionCategories(CalculateAssessmentSectionCategoriesInput input) { var aPlusToA = 1 / 30.0 * input.SignalingStandard; var cToD = 30 * input.LowerBoundaryStandard; var categories = new[] { new AssessmentSectionCategory(AssessmentSectionCategoryGroup.APlus, (Probability)0, aPlusToA), new AssessmentSectionCategory(AssessmentSectionCategoryGroup.A, aPlusToA, input.SignalingStandard), new AssessmentSectionCategory(AssessmentSectionCategoryGroup.B, input.SignalingStandard, input.LowerBoundaryStandard), new AssessmentSectionCategory(AssessmentSectionCategoryGroup.C, input.LowerBoundaryStandard, cToD), new AssessmentSectionCategory(AssessmentSectionCategoryGroup.D, cToD, (Probability)1), }; return(new CalculationOutput <AssessmentSectionCategory[]>(categories)); }