Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Input/AssemblyCategoriesCalculatorInput.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/AssemblyCategoryResult.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/AssessmentSectionAssemblyCategoryResult.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/AssessmentSectionAssemblyCategoryResultType.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Ringtoets.AssemblyTool.Data.csproj =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Ringtoets.AssemblyTool.Data.csproj (.../Ringtoets.AssemblyTool.Data.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Ringtoets.AssemblyTool.Data.csproj (.../Ringtoets.AssemblyTool.Data.csproj) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -11,15 +11,15 @@ - - - - Copying.licenseheader + + + + \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/AssemblyCategoriesCalculator.cs =================================================================== diff -u -r779534c383f7501bb19363a7fbf4e0acd60ab379 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/AssemblyCategoriesCalculator.cs (.../AssemblyCategoriesCalculator.cs) (revision 779534c383f7501bb19363a7fbf4e0acd60ab379) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/AssemblyCategoriesCalculator.cs (.../AssemblyCategoriesCalculator.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -22,12 +22,14 @@ using System; using System.Collections.Generic; using AssemblyTool.Kernel; -using AssemblyTool.Kernel.CategoriesOutput; -using Ringtoets.AssemblyTool.Data.Input; -using Ringtoets.AssemblyTool.Data.Output; +using AssemblyTool.Kernel.Categories; +using AssemblyTool.Kernel.Categories.CalculatorInput; +using AssemblyTool.Kernel.Data; +using AssemblyTool.Kernel.Data.AssemblyCategories; using Ringtoets.AssemblyTool.KernelWrapper.Creators; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; +using Ringtoets.Common.Data.AssemblyTool; namespace Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories { @@ -52,20 +54,15 @@ this.factory = factory; } - public IEnumerable CalculateAssessmentSectionCategories( - AssemblyCategoriesCalculatorInput input) + public IEnumerable CalculateAssessmentSectionCategories(double signalingNorm, double lowerBoundaryNorm) { - if (input == null) - { - throw new ArgumentNullException(nameof(input)); - } - try { - IAssemblyCategoriesKernel kernel = factory.CreateAssemblyCategoriesKernel(); - CalculationOutput output = kernel.Calculate(input.SignalingNorm, input.LowerBoundaryNorm); + var kernelInput = new CalculateAssessmentSectionCategoriesInput(new Probability(signalingNorm), new Probability(lowerBoundaryNorm)); + ICategoriesCalculator kernel = factory.CreateAssemblyCategoriesKernel(); + CalculationOutput output = kernel.CalculateAssessmentSectionCategories(kernelInput); - return AssemblyCategoryResultCreator.CreateAssessmentSectionAssemblyCategoryResult(output); + return AssessmentSectionAssemblyCategoryCreator.CreateAssessmentSectionAssemblyCategories(output); } catch (AssemblyCategoriesKernelWrapperException e) { Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs =================================================================== diff -u -r779534c383f7501bb19363a7fbf4e0acd60ab379 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs (.../IAssemblyCategoriesCalculator.cs) (revision 779534c383f7501bb19363a7fbf4e0acd60ab379) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs (.../IAssemblyCategoriesCalculator.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -21,8 +21,7 @@ using System; using System.Collections.Generic; -using Ringtoets.AssemblyTool.Data.Input; -using Ringtoets.AssemblyTool.Data.Output; +using Ringtoets.Common.Data.AssemblyTool; namespace Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories { @@ -41,15 +40,13 @@ /// /// Performs the calculation for getting the assessment section categories. /// - /// The containing - /// all the values required for performing the assembly categories calculation. + /// The signaling norm to calculate with. + /// The lower boundary norm to calculate with. /// An with categories of - /// . - /// Thrown when - /// is null. + /// . /// Thrown when an error occurs /// when performing the calculation. - IEnumerable CalculateAssessmentSectionCategories( - AssemblyCategoriesCalculatorInput input); + IEnumerable CalculateAssessmentSectionCategories( + double signalingNorm, double lowerBoundaryNorm); } } \ No newline at end of file Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssemblyCategoryResultCreator.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssessmentSectionAssemblyCategoryCreator.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssessmentSectionAssemblyCategoryCreator.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssessmentSectionAssemblyCategoryCreator.cs (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -0,0 +1,98 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using AssemblyTool.Kernel; +using AssemblyTool.Kernel.Data.AssemblyCategories; +using Ringtoets.Common.Data.AssemblyTool; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Creators +{ + /// + /// Creates instances. + /// + internal static class AssessmentSectionAssemblyCategoryCreator + { + /// + /// Creates an + /// based on the information given in the . + /// + /// The output to create the result for. + /// An + /// with information taken from the . + /// Thrown when is null. + /// Thrown when + /// is an invalid value. + /// Thrown when + /// is a valid value, but unsupported. + public static IEnumerable CreateAssessmentSectionAssemblyCategories( + CalculationOutput output) + { + if (output == null) + { + throw new ArgumentNullException(nameof(output)); + } + + return output.Result.Select( + categoriesOutput => new AssessmentSectionAssemblyCategory(categoriesOutput.LowerBoundary, + categoriesOutput.UpperBoundary, + ConvertAssessmentSectionCategoryGroup(categoriesOutput.CategoryGroup))).ToArray(); + } + + /// + /// Converts a into a . + /// + /// The to convert. + /// A based on . + /// Thrown when + /// is an invalid value. + /// Thrown when + /// is a valid value, but unsupported. + private static AssessmentSectionAssemblyCategoryGroup ConvertAssessmentSectionCategoryGroup(AssessmentSectionCategoryGroup category) + { + if (!Enum.IsDefined(typeof(AssessmentSectionCategoryGroup), category)) + { + throw new InvalidEnumArgumentException(nameof(category), + (int) category, + typeof(AssessmentSectionCategoryGroup)); + } + + switch (category) + { + case AssessmentSectionCategoryGroup.APlus: + return AssessmentSectionAssemblyCategoryGroup.APlus; + case AssessmentSectionCategoryGroup.A: + return AssessmentSectionAssemblyCategoryGroup.A; + case AssessmentSectionCategoryGroup.B: + return AssessmentSectionAssemblyCategoryGroup.B; + case AssessmentSectionCategoryGroup.C: + return AssessmentSectionAssemblyCategoryGroup.C; + case AssessmentSectionCategoryGroup.D: + return AssessmentSectionAssemblyCategoryGroup.D; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/AssemblyToolKernelWrapperFactory.cs =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/AssemblyToolKernelWrapperFactory.cs (.../AssemblyToolKernelWrapperFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/AssemblyToolKernelWrapperFactory.cs (.../AssemblyToolKernelWrapperFactory.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using AssemblyTool.Kernel.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; namespace Ringtoets.AssemblyTool.KernelWrapper.Kernels @@ -45,9 +46,9 @@ } } - public IAssemblyCategoriesKernel CreateAssemblyCategoriesKernel() + public ICategoriesCalculator CreateAssemblyCategoriesKernel() { - return new AssemblyCategoriesKernelWrapper(); + return new CategoriesCalculator(); } } } \ No newline at end of file Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/Categories/AssemblyCategoriesKernelWrapper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/Categories/IAssemblyCategoriesKernel.cs =================================================================== diff -u -r82c31612ab2e04315cca968c00feb1758cc0e987 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/Categories/IAssemblyCategoriesKernel.cs (.../IAssemblyCategoriesKernel.cs) (revision 82c31612ab2e04315cca968c00feb1758cc0e987) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/Categories/IAssemblyCategoriesKernel.cs (.../IAssemblyCategoriesKernel.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -20,7 +20,7 @@ // All rights reserved. using AssemblyTool.Kernel; -using AssemblyTool.Kernel.CategoriesOutput; +using AssemblyTool.Kernel.Data.AssemblyCategories; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; namespace Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories @@ -45,6 +45,6 @@ /// The calculation output. /// Thrown when an error occurs /// when performing the calculation. - CalculationOutput Calculate(double signalingNorm, double lowerBoundaryNorm); + CalculationOutput Calculate(double signalingNorm, double lowerBoundaryNorm); } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/IAssemblyToolKernelFactory.cs =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/IAssemblyToolKernelFactory.cs (.../IAssemblyToolKernelFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/IAssemblyToolKernelFactory.cs (.../IAssemblyToolKernelFactory.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -19,7 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; +using AssemblyTool.Kernel.Categories; namespace Ringtoets.AssemblyTool.KernelWrapper.Kernels { @@ -31,7 +31,9 @@ /// /// Creates an assembly categories kernel. /// - /// A new . - IAssemblyCategoriesKernel CreateAssemblyCategoriesKernel(); + /// A new . + ICategoriesCalculator CreateAssemblyCategoriesKernel(); + + // TODO expose kernel interface } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Ringtoets.AssemblyTool.KernelWrapper.csproj =================================================================== diff -u -r61230a2dbf617e3571d855e7271ba8de0e7aa29d -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Ringtoets.AssemblyTool.KernelWrapper.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.csproj) (revision 61230a2dbf617e3571d855e7271ba8de0e7aa29d) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Ringtoets.AssemblyTool.KernelWrapper.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.csproj) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -21,9 +21,8 @@ - + - Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Input/AssemblyCategoriesCalculatorInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Output/AssemblyCategoryResultTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Output/AssessmentSectionAssemblyCategoryResultTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Output/AssessmentSectionAssemblyCategoryResultTypeTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Ringtoets.AssemblyTool.Data.Test.csproj =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Ringtoets.AssemblyTool.Data.Test.csproj (.../Ringtoets.AssemblyTool.Data.Test.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Ringtoets.AssemblyTool.Data.Test.csproj (.../Ringtoets.AssemblyTool.Data.Test.csproj) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -14,10 +14,6 @@ - - - - @@ -36,4 +32,8 @@ Ringtoets.AssemblyTool.Data + + + + \ No newline at end of file Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/AssemblyCategoryResultAssert.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/AssessmentSectionAssemblyCategoryAssert.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/AssessmentSectionAssemblyCategoryAssert.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/AssessmentSectionAssemblyCategoryAssert.cs (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -0,0 +1,73 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using AssemblyTool.Kernel; +using AssemblyTool.Kernel.Data.AssemblyCategories; +using NUnit.Framework; +using Ringtoets.Common.Data.AssemblyTool; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Test +{ + /// + /// Class for asserting categories result. + /// + public static class AssessmentSectionAssemblyCategoryAssert + { + /// + /// Asserts whether is equal to . + /// + /// The original . + /// The actual . + /// Thrown when + /// is not equal to . + public static void AssertAssessmentSectionAssemblyCategories(CalculationOutput original, + IEnumerable actual) + { + Assert.AreEqual(original.Result.Length, actual.Count()); + + CollectionAssert.AreEqual(original.Result.Select(o => GetCategoryGroup(o.CategoryGroup)), actual.Select(r => r.Group)); + CollectionAssert.AreEqual(original.Result.Select(o => o.LowerBoundary), actual.Select(r => r.LowerBoundary)); + CollectionAssert.AreEqual(original.Result.Select(o => o.UpperBoundary), actual.Select(r => r.UpperBoundary)); + } + + private static AssessmentSectionAssemblyCategoryGroup GetCategoryGroup(AssessmentSectionCategoryGroup category) + { + switch (category) + { + case AssessmentSectionCategoryGroup.APlus: + return AssessmentSectionAssemblyCategoryGroup.APlus; + case AssessmentSectionCategoryGroup.A: + return AssessmentSectionAssemblyCategoryGroup.A; + case AssessmentSectionCategoryGroup.B: + return AssessmentSectionAssemblyCategoryGroup.B; + case AssessmentSectionCategoryGroup.C: + return AssessmentSectionAssemblyCategoryGroup.C; + case AssessmentSectionCategoryGroup.D: + return AssessmentSectionAssemblyCategoryGroup.D; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Categories/AssemblyCategoriesCalculatorTest.cs =================================================================== diff -u -r779534c383f7501bb19363a7fbf4e0acd60ab379 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Categories/AssemblyCategoriesCalculatorTest.cs (.../AssemblyCategoriesCalculatorTest.cs) (revision 779534c383f7501bb19363a7fbf4e0acd60ab379) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Categories/AssemblyCategoriesCalculatorTest.cs (.../AssemblyCategoriesCalculatorTest.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -22,18 +22,17 @@ using System; using System.Collections.Generic; using AssemblyTool.Kernel; -using AssemblyTool.Kernel.CategoriesOutput; using AssemblyTool.Kernel.Data; +using AssemblyTool.Kernel.Data.AssemblyCategories; using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.AssemblyTool.Data.Input; -using Ringtoets.AssemblyTool.Data.Output; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels.Categories; +using Ringtoets.Common.Data.AssemblyTool; namespace Ringtoets.AssemblyTool.KernelWrapper.Test.Calculators.Categories { @@ -68,32 +67,12 @@ } [Test] - public void CalculateAssessmentSectionCategories_InputNull_ThrowsArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - var factory = mocks.Stub(); - mocks.ReplayAll(); - - var calculator = new AssemblyCategoriesCalculator(factory); - - // Call - TestDelegate call = () => calculator.CalculateAssessmentSectionCategories(null); - - // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("input", exception.ParamName); - mocks.VerifyAll(); - } - - [Test] public void CalculateAssessmentSectionCategories_WithInput_InputCorrectlySetToKernel() { // Setup var random = new Random(11); double lowerBoundaryNorm = random.NextDouble(); double signalingNorm = random.NextDouble(); - var input = new AssemblyCategoriesCalculatorInput(signalingNorm, lowerBoundaryNorm); using (new AssemblyToolKernelFactoryConfig()) { @@ -104,7 +83,7 @@ var calculator = new AssemblyCategoriesCalculator(factory); // Call - calculator.CalculateAssessmentSectionCategories(input); + calculator.CalculateAssessmentSectionCategories(signalingNorm, lowerBoundaryNorm); // Assert Assert.AreEqual(lowerBoundaryNorm, kernel.LowerBoundaryNorm); @@ -119,22 +98,21 @@ var random = new Random(11); double lowerBoundaryNorm = random.NextDouble(); double signalingNorm = random.NextDouble(); - var input = new AssemblyCategoriesCalculatorInput(signalingNorm, lowerBoundaryNorm); - CalculationOutput output = CreateKernelOutput(); + CalculationOutput output = CreateKernelOutput(); using (new AssemblyToolKernelFactoryConfig()) { - var factory = (TestAssemblyToolKernelFactory)AssemblyToolKernelWrapperFactory.Instance; + var factory = (TestAssemblyToolKernelFactory) AssemblyToolKernelWrapperFactory.Instance; AssemblyCategoriesKernelStub kernel = factory.LastCreatedAssemblyCategoriesKernel; kernel.AssessmentSectionCategoriesOutput = output; var calculator = new AssemblyCategoriesCalculator(factory); // Call - IEnumerable result = calculator.CalculateAssessmentSectionCategories(input); + IEnumerable result = calculator.CalculateAssessmentSectionCategories(signalingNorm, lowerBoundaryNorm); // Assert - AssemblyCategoryResultAssert.AssertAssessmentSectionAssemblyCategoriesResult(output, result); + AssessmentSectionAssemblyCategoryAssert.AssertAssessmentSectionAssemblyCategories(output, result); } } @@ -145,7 +123,6 @@ var random = new Random(11); double lowerBoundaryNorm = random.NextDouble(); double signalingNorm = random.NextDouble(); - var input = new AssemblyCategoriesCalculatorInput(signalingNorm, lowerBoundaryNorm); using (new AssemblyToolKernelFactoryConfig()) { @@ -156,7 +133,7 @@ var calculator = new AssemblyCategoriesCalculator(factory); // Call - TestDelegate test = () => calculator.CalculateAssessmentSectionCategories(input); + TestDelegate test = () => calculator.CalculateAssessmentSectionCategories(signalingNorm, lowerBoundaryNorm); // Assert var exception = Assert.Throws(test); @@ -165,16 +142,16 @@ } } - private static CalculationOutput CreateKernelOutput() + private static CalculationOutput CreateKernelOutput() { var random = new Random(11); - return new CalculationOutput(new[] + return new CalculationOutput(new[] { - new AssessmentSectionCategoriesOutput(random.NextEnumValue(), random.Next(1), random.Next(1, 2)), - new AssessmentSectionCategoriesOutput(random.NextEnumValue(), random.Next(1), random.Next(1, 2)), - new AssessmentSectionCategoriesOutput(random.NextEnumValue(), random.Next(1), random.Next(1, 2)), - new AssessmentSectionCategoriesOutput(random.NextEnumValue(), random.Next(1), random.Next(1, 2)) + new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.Next(1)), new Probability(random.Next(1, 2))), + new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.Next(1)), new Probability(random.Next(1, 2))), + new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.Next(1)), new Probability(random.Next(1, 2))), + new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.Next(1)), new Probability(random.Next(1, 2))) }); } } Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssemblyCategoryResultCreatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssessmentSectionAssemblyCategoryCreatorTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssessmentSectionAssemblyCategoryCreatorTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssessmentSectionAssemblyCategoryCreatorTest.cs (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -0,0 +1,114 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using AssemblyTool.Kernel; +using AssemblyTool.Kernel.Data; +using AssemblyTool.Kernel.Data.AssemblyCategories; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.AssemblyTool.KernelWrapper.Creators; +using Ringtoets.Common.Data.AssemblyTool; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Test.Creators +{ + [TestFixture] + public class AssessmentSectionAssemblyCategoryCreatorTest + { + [Test] + public void CreateAssessmentSectionAssemblyCategories_OutputNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => AssessmentSectionAssemblyCategoryCreator.CreateAssessmentSectionAssemblyCategories(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("output", exception.ParamName); + } + + [Test] + public void CreateAssessmentSectionAssemblyCategories_WithOutput_ReturnAssessmentSectionAssemblyCategoryResult() + { + // Setup + var random = new Random(11); + + var output = new CalculationOutput(new[] + { + new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.Next(1)), new Probability(random.Next(1, 2))), + new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.Next(1)), new Probability(random.Next(1, 2))), + new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.Next(1)), new Probability(random.Next(1, 2))), + new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.Next(1)), new Probability(random.Next(1, 2))) + }); + + // Call + IEnumerable result = AssessmentSectionAssemblyCategoryCreator.CreateAssessmentSectionAssemblyCategories(output); + + // Assert + AssessmentSectionAssemblyCategoryAssert.AssertAssessmentSectionAssemblyCategories(output, result); + } + + [Test] + public void CreateAssessmentSectionAssemblyCategories_CategoryWithInvalidAssessmentSectionAssemblyCategory_ThrowsInvalidEnumArgumentException() + { + // Setup + var output = new CalculationOutput(new[] + { + new AssessmentSectionCategory((AssessmentSectionCategoryGroup) 99, new Probability(0), new Probability(0)) + }); + + // Call + TestDelegate test = () => AssessmentSectionAssemblyCategoryCreator.CreateAssessmentSectionAssemblyCategories(output); + + // Assert + const string exceptionMessage = "The value of argument 'category' (99) is invalid for Enum type 'AssessmentSectionCategoryGroup'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, exceptionMessage); + } + + [Test] + [TestCase(AssessmentSectionCategoryGroup.APlus, AssessmentSectionAssemblyCategoryGroup.APlus)] + [TestCase(AssessmentSectionCategoryGroup.A, AssessmentSectionAssemblyCategoryGroup.A)] + [TestCase(AssessmentSectionCategoryGroup.B, AssessmentSectionAssemblyCategoryGroup.B)] + [TestCase(AssessmentSectionCategoryGroup.C, AssessmentSectionAssemblyCategoryGroup.C)] + [TestCase(AssessmentSectionCategoryGroup.D, AssessmentSectionAssemblyCategoryGroup.D)] + public void CreateAssessmentSectionAssemblyCategories_CategoryWithValidAssessmentSectionAssemblyCategory_ExpectedAssessmentSectionAssemblyCategoryResultType( + AssessmentSectionCategoryGroup categoryGroup, + AssessmentSectionAssemblyCategoryGroup expectedCategoryGroup) + { + // Setup + var output = new CalculationOutput(new[] + { + new AssessmentSectionCategory(categoryGroup, new Probability(0), new Probability(0)) + }); + + // Call + IEnumerable result = AssessmentSectionAssemblyCategoryCreator.CreateAssessmentSectionAssemblyCategories(output); + + // Assert + Assert.AreEqual(1, result.Count()); + AssessmentSectionAssemblyCategory categoryResult = result.First(); + + Assert.AreEqual(expectedCategoryGroup, categoryResult.Group); + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/AssemblyToolKernelWrapperFactoryTest.cs =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/AssemblyToolKernelWrapperFactoryTest.cs (.../AssemblyToolKernelWrapperFactoryTest.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/AssemblyToolKernelWrapperFactoryTest.cs (.../AssemblyToolKernelWrapperFactoryTest.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -19,9 +19,9 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using AssemblyTool.Kernel.Categories; using NUnit.Framework; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; -using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels; namespace Ringtoets.AssemblyTool.KernelWrapper.Test.Kernels @@ -68,16 +68,16 @@ } [Test] - public void CreateAssemblyCategoriesKernel_Always_ReturnsAssemblyCategoriesKernelWrapper() + public void CreateAssemblyCategoriesKernel_Always_ReturnsKernelCategoriesCalculator() { // Setup IAssemblyToolKernelFactory factory = AssemblyToolKernelWrapperFactory.Instance; // Call - IAssemblyCategoriesKernel assemblyCategoriesKernel = factory.CreateAssemblyCategoriesKernel(); + ICategoriesCalculator assemblyCategoriesKernel = factory.CreateAssemblyCategoriesKernel(); // Assert - Assert.IsInstanceOf(assemblyCategoriesKernel); + Assert.IsInstanceOf(assemblyCategoriesKernel); } } } \ No newline at end of file Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/Categories/AssemblyCategoriesKernelWrapperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Ringtoets.AssemblyTool.KernelWrapper.Test.csproj =================================================================== diff -u -r61230a2dbf617e3571d855e7271ba8de0e7aa29d -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Ringtoets.AssemblyTool.KernelWrapper.Test.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.Test.csproj) (revision 61230a2dbf617e3571d855e7271ba8de0e7aa29d) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Ringtoets.AssemblyTool.KernelWrapper.Test.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.Test.csproj) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -20,15 +20,14 @@ - + - + - @@ -42,6 +41,10 @@ {D749EE4C-CE50-4C17-BF01-9A953028C126} Core.Common.TestUtil + + {d4200f43-3f72-4f42-af0a-8ced416a38ec} + Ringtoets.Common.Data + {420ED9C3-0C33-47EA-B893-121A9C0DB4F1} Ringtoets.AssemblyTool.Data Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs =================================================================== diff -u -rccc77eb1d25d2f6e73e7b6547f2cc87b4d077713 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs (.../AssemblyCategoriesCalculatorStubTest.cs) (revision ccc77eb1d25d2f6e73e7b6547f2cc87b4d077713) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs (.../AssemblyCategoriesCalculatorStubTest.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -19,13 +19,13 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; -using Ringtoets.AssemblyTool.Data.Input; -using Ringtoets.AssemblyTool.Data.Output; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories; +using Ringtoets.Common.Data.AssemblyTool; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.Calculators.Categories { @@ -40,7 +40,6 @@ // Assert Assert.IsInstanceOf(calculator); - Assert.IsNull(calculator.Input); Assert.IsNull(calculator.AssessmentSectionCategoriesOutput); } @@ -51,7 +50,7 @@ var calculator = new AssemblyCategoriesCalculatorStub(); // Call - AssessmentSectionAssemblyCategoryResult[] result = calculator.CalculateAssessmentSectionCategories(null).ToArray(); + AssessmentSectionAssemblyCategory[] result = calculator.CalculateAssessmentSectionCategories(0, 0).ToArray(); // Assert Assert.AreEqual(3, result.Length); @@ -69,24 +68,24 @@ }, result.Select(r => r.UpperBoundary)); CollectionAssert.AreEqual(new[] { - AssessmentSectionAssemblyCategoryResultType.A, - AssessmentSectionAssemblyCategoryResultType.B, - AssessmentSectionAssemblyCategoryResultType.C - }, result.Select(r => r.Category)); + AssessmentSectionAssemblyCategoryGroup.A, + AssessmentSectionAssemblyCategoryGroup.B, + AssessmentSectionAssemblyCategoryGroup.C + }, result.Select(r => r.Group)); } [Test] public void CalculateAssessmentSectionCategories_OutputSetAndThrowExceptionOnCalculateFalse_ReturnsCategories() { // Setup - var output = new AssessmentSectionAssemblyCategoryResult[0]; + var output = new AssessmentSectionAssemblyCategory[0]; var calculator = new AssemblyCategoriesCalculatorStub { AssessmentSectionCategoriesOutput = output }; // Call - IEnumerable result = calculator.CalculateAssessmentSectionCategories(null); + IEnumerable result = calculator.CalculateAssessmentSectionCategories(0 ,0); // Assert Assert.AreSame(output, result); @@ -96,14 +95,18 @@ public void CalculateAssessmentSectionCategories_ThrowExceptionOnCalculateFalse_SetsInput() { // Setup - var input = new AssemblyCategoriesCalculatorInput(0, 0); + var random = new Random(39); + double signalingNorm = random.NextDouble(); + double lowerBoundaryNorm = random.NextDouble(); + var calculator = new AssemblyCategoriesCalculatorStub(); // Call - calculator.CalculateAssessmentSectionCategories(input); + calculator.CalculateAssessmentSectionCategories(signalingNorm, lowerBoundaryNorm); // Assert - Assert.AreSame(input, calculator.Input); + Assert.AreEqual(signalingNorm, calculator.SignalingNorm); + Assert.AreEqual(lowerBoundaryNorm, calculator.LowerBoundaryNorm); } [Test] @@ -116,14 +119,12 @@ }; // Call - TestDelegate test = () => calculator.CalculateAssessmentSectionCategories(new AssemblyCategoriesCalculatorInput(0, 0)); + TestDelegate test = () => calculator.CalculateAssessmentSectionCategories(0, 0); // Assert var exception = Assert.Throws(test); Assert.AreEqual("Message", exception.Message); Assert.IsNotNull(exception.InnerException); - - Assert.IsNull(calculator.Input); } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs =================================================================== diff -u -r9c274457523062aad7b755fa88b20277c5d86bcb -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs (.../TestAssemblyToolCalculatorFactoryTest.cs) (revision 9c274457523062aad7b755fa88b20277c5d86bcb) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs (.../TestAssemblyToolCalculatorFactoryTest.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -41,7 +41,6 @@ // Assert Assert.IsInstanceOf(factory); Assert.IsNotNull(factory.LastCreatedAssemblyCategoriesCalculator); - Assert.IsNull(factory.LastCreatedAssemblyCategoriesCalculator.Input); } [Test] Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Categories/AssemblyCategoriesKernelStubTest.cs =================================================================== diff -u -rccc77eb1d25d2f6e73e7b6547f2cc87b4d077713 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Categories/AssemblyCategoriesKernelStubTest.cs (.../AssemblyCategoriesKernelStubTest.cs) (revision ccc77eb1d25d2f6e73e7b6547f2cc87b4d077713) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Categories/AssemblyCategoriesKernelStubTest.cs (.../AssemblyCategoriesKernelStubTest.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -21,7 +21,10 @@ using System; using AssemblyTool.Kernel; -using AssemblyTool.Kernel.CategoriesOutput; +using AssemblyTool.Kernel.Categories; +using AssemblyTool.Kernel.Categories.CalculatorInput; +using AssemblyTool.Kernel.Data; +using AssemblyTool.Kernel.Data.AssemblyCategories; using NUnit.Framework; using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels.Categories; @@ -38,78 +41,82 @@ var kernelStub = new AssemblyCategoriesKernelStub(); // Assert - Assert.IsInstanceOf(kernelStub); + Assert.IsInstanceOf(kernelStub); Assert.IsFalse(kernelStub.Calculated); } [Test] - public void Calculate_ThrowExceptionOnCalculateFalse_InputCorrectlySetToKernel() + public void CalculateAssessmentSectionCategories_ThrowExceptionOnCalculateFalse_InputCorrectlySetToKernel() { // Setup var random = new Random(11); - double lowerBoundaryNorm = random.NextDouble(); - double signalingNorm = random.NextDouble(); + var lowerBoundaryNorm = new Probability(random.NextDouble()); + var signalingNorm = new Probability(random.NextDouble()); var kernelStub = new AssemblyCategoriesKernelStub(); - + var input = new CalculateAssessmentSectionCategoriesInput(signalingNorm, lowerBoundaryNorm); + // Call - kernelStub.Calculate(signalingNorm, lowerBoundaryNorm); + kernelStub.CalculateAssessmentSectionCategories(input); // Assert Assert.AreEqual(signalingNorm, kernelStub.SignalingNorm); Assert.AreEqual(lowerBoundaryNorm, kernelStub.LowerBoundaryNorm); } [Test] - public void Calculate_ThrowExceptionOnCalculateFalse_SetCalculatedTrue() + public void CalculateAssessmentSectionCategories_ThrowExceptionOnCalculateFalse_SetCalculatedTrue() { // Setup var kernelStub = new AssemblyCategoriesKernelStub(); + // Precondition + Assert.IsFalse(kernelStub.Calculated); + // Call - kernelStub.Calculate(0, 0); + kernelStub.CalculateAssessmentSectionCategories(new CalculateAssessmentSectionCategoriesInput(new Probability(0), new Probability(0))); // Assert Assert.IsTrue(kernelStub.Calculated); } [Test] - public void Calculate_ThrowExceptionOnCalculateFalse_ReturnAssessmentSectionCategoriesOutput() + public void CalculateAssessmentSectionCategories_ThrowExceptionOnCalculateFalse_ReturnAssessmentSectionCategories() { // Setup var kernelStub = new AssemblyCategoriesKernelStub { - AssessmentSectionCategoriesOutput = new CalculationOutput(new AssessmentSectionCategoriesOutput[0]) + AssessmentSectionCategoriesOutput = new CalculationOutput(new AssessmentSectionCategory[0]) }; // Call - CalculationOutput output = kernelStub.Calculate(0, 0); + CalculationOutput output = kernelStub.CalculateAssessmentSectionCategories(new CalculateAssessmentSectionCategoriesInput(new Probability(0), new Probability(0))); // Assert Assert.AreSame(kernelStub.AssessmentSectionCategoriesOutput, output); } [Test] - public void Calculate_ThrowExceptionOnCalculateTrue_ThrowsAssemblyCategoriesKernelWrapperException() + public void CalculateAssessmentSectionCategories_ThrowExceptionOnCalculateTrue_ThrowsAssemblyCategoriesKernelWrapperException() { // Setup - var kernel = new AssemblyCategoriesKernelStub + var kernelStub = new AssemblyCategoriesKernelStub { ThrowExceptionOnCalculate = true }; // Precondition - Assert.IsFalse(kernel.Calculated); + Assert.IsFalse(kernelStub.Calculated); // Call - TestDelegate test = () => kernel.Calculate(0, 0); + TestDelegate test = () => kernelStub.CalculateAssessmentSectionCategories(new CalculateAssessmentSectionCategoriesInput(new Probability(0), new Probability(0))); // Assert var exception = Assert.Throws(test); Assert.AreEqual("Message", exception.Message); Assert.IsNotNull(exception.InnerException); - Assert.IsFalse(kernel.Calculated); - Assert.IsNull(kernel.AssessmentSectionCategoriesOutput); + Assert.IsFalse(kernelStub.Calculated); + Assert.IsNull(kernelStub.AssessmentSectionCategoriesOutput); } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/TestAssemblyToolKernelFactoryTest.cs =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/TestAssemblyToolKernelFactoryTest.cs (.../TestAssemblyToolKernelFactoryTest.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/TestAssemblyToolKernelFactoryTest.cs (.../TestAssemblyToolKernelFactoryTest.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -19,9 +19,9 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using AssemblyTool.Kernel.Categories; using NUnit.Framework; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; -using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.Kernels @@ -47,7 +47,7 @@ var factory = new TestAssemblyToolKernelFactory(); // Call - IAssemblyCategoriesKernel kernel = factory.CreateAssemblyCategoriesKernel(); + ICategoriesCalculator kernel = factory.CreateAssemblyCategoriesKernel(); // Assert Assert.AreSame(factory.LastCreatedAssemblyCategoriesKernel, kernel); Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.csproj =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.csproj) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -32,6 +32,10 @@ + + {d4200f43-3f72-4f42-af0a-8ced416a38ec} + Ringtoets.Common.Data + {420ED9C3-0C33-47EA-B893-121A9C0DB4F1} Ringtoets.AssemblyTool.Data Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs =================================================================== diff -u -rccc77eb1d25d2f6e73e7b6547f2cc87b4d077713 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs (.../AssemblyCategoriesCalculatorStub.cs) (revision ccc77eb1d25d2f6e73e7b6547f2cc87b4d077713) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs (.../AssemblyCategoriesCalculatorStub.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -20,10 +20,9 @@ // All rights reserved. using System.Collections.Generic; -using Ringtoets.AssemblyTool.Data.Input; -using Ringtoets.AssemblyTool.Data.Output; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; +using Ringtoets.Common.Data.AssemblyTool; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories { @@ -33,36 +32,41 @@ public class AssemblyCategoriesCalculatorStub : IAssemblyCategoriesCalculator { /// - /// Gets the assembly categories calculator input. + /// Gets the signaling norm that is used in the calculation. /// - public AssemblyCategoriesCalculatorInput Input { get; private set; } + public double SignalingNorm { get; private set; } /// - /// Gets or sets the output of the calculation. + /// Gets the lower boundary norm that is used in the calculation. /// - public IEnumerable AssessmentSectionCategoriesOutput { get; set; } + public double LowerBoundaryNorm { get; private set; } /// + /// Gets or sets the output of the calculation. + /// + public IEnumerable AssessmentSectionCategoriesOutput { get; set; } + + /// /// Indicator whether an exception must be thrown when performing the calculation. /// public bool ThrowExceptionOnCalculate { private get; set; } - public IEnumerable CalculateAssessmentSectionCategories( - AssemblyCategoriesCalculatorInput input) + public IEnumerable CalculateAssessmentSectionCategories(double signalingNorm, double lowerBoundaryNorm) { if (ThrowExceptionOnCalculate) { throw new AssemblyCategoriesCalculatorException("Message", new AssemblyCategoriesKernelWrapperException()); } - Input = input; + SignalingNorm = signalingNorm; + LowerBoundaryNorm = lowerBoundaryNorm; return AssessmentSectionCategoriesOutput ?? (AssessmentSectionCategoriesOutput = new[] { - new AssessmentSectionAssemblyCategoryResult(1, 2, AssessmentSectionAssemblyCategoryResultType.A), - new AssessmentSectionAssemblyCategoryResult(2.01, 3, AssessmentSectionAssemblyCategoryResultType.B), - new AssessmentSectionAssemblyCategoryResult(3.01, 4, AssessmentSectionAssemblyCategoryResultType.C) + new AssessmentSectionAssemblyCategory(1, 2, AssessmentSectionAssemblyCategoryGroup.A), + new AssessmentSectionAssemblyCategory(2.01, 3, AssessmentSectionAssemblyCategoryGroup.B), + new AssessmentSectionAssemblyCategory(3.01, 4, AssessmentSectionAssemblyCategoryGroup.C) }); } } Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Categories/AssemblyCategoriesKernelStub.cs =================================================================== diff -u -rccc77eb1d25d2f6e73e7b6547f2cc87b4d077713 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Categories/AssemblyCategoriesKernelStub.cs (.../AssemblyCategoriesKernelStub.cs) (revision ccc77eb1d25d2f6e73e7b6547f2cc87b4d077713) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Categories/AssemblyCategoriesKernelStub.cs (.../AssemblyCategoriesKernelStub.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -21,18 +21,20 @@ using System; using AssemblyTool.Kernel; -using AssemblyTool.Kernel.CategoriesOutput; +using AssemblyTool.Kernel.Categories; +using AssemblyTool.Kernel.Categories.CalculatorInput; +using AssemblyTool.Kernel.Data.AssemblyCategories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels.Categories { /// /// Assembly categories kernel stub for testing purposes. /// - public class AssemblyCategoriesKernelStub : IAssemblyCategoriesKernel + public class AssemblyCategoriesKernelStub : ICategoriesCalculator { /// - /// Gets a value indicating whether was called or not. + /// Gets a value indicating whether was called or not. /// public bool Calculated { get; private set; } @@ -54,21 +56,37 @@ /// /// Gets or sets the assessment section categories output. /// - public CalculationOutput AssessmentSectionCategoriesOutput { get; set; } + public CalculationOutput AssessmentSectionCategoriesOutput { get; set; } - public CalculationOutput Calculate(double signalingNorm, double lowerBoundaryNorm) + public CalculationOutput CalculateAssessmentSectionCategories(CalculateAssessmentSectionCategoriesInput input) { if (ThrowExceptionOnCalculate) { throw new AssemblyCategoriesKernelWrapperException("Message", new Exception()); } - LowerBoundaryNorm = lowerBoundaryNorm; - SignalingNorm = signalingNorm; + SignalingNorm = input.SignalingStandard; + LowerBoundaryNorm = input.LowerBoundaryStandard; + Calculated = true; return AssessmentSectionCategoriesOutput; } + + public CalculationOutput CalculateFailureMechanismCategories(CalculateFailureMechanismCategoriesInput input) + { + throw new NotImplementedException(); + } + + public CalculationOutput CalculateFailureMechanismSectionCategories(CalculateFailureMechanismSectionCategoriesInput input) + { + throw new NotImplementedException(); + } + + public CalculationOutput CalculateGeotechnicFailureMechanismSectionCategories(CalculateFailureMechanismSectionCategoriesInput input) + { + throw new NotImplementedException(); + } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/TestAssemblyToolKernelFactory.cs =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/TestAssemblyToolKernelFactory.cs (.../TestAssemblyToolKernelFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/TestAssemblyToolKernelFactory.cs (.../TestAssemblyToolKernelFactory.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -19,8 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using AssemblyTool.Kernel.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; -using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels.Categories; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels @@ -43,7 +43,7 @@ /// public AssemblyCategoriesKernelStub LastCreatedAssemblyCategoriesKernel { get; } - public IAssemblyCategoriesKernel CreateAssemblyCategoriesKernel() + public ICategoriesCalculator CreateAssemblyCategoriesKernel() { return LastCreatedAssemblyCategoriesKernel; } Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.csproj =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.TestUtil.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.TestUtil.csproj) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -29,6 +29,10 @@ + + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} + Ringtoets.Common.Data + {420ED9C3-0C33-47EA-B893-121A9C0DB4F1} Ringtoets.AssemblyTool.Data Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Service/AssemblyTool/AssemblyCategoryConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Service/AssemblyTool/AssemblyCategoryInputConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Service/AssemblyTool/AssemblyToolCategoriesCalculationService.cs =================================================================== diff -u -rccc77eb1d25d2f6e73e7b6547f2cc87b4d077713 -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/Common/src/Ringtoets.Common.Service/AssemblyTool/AssemblyToolCategoriesCalculationService.cs (.../AssemblyToolCategoriesCalculationService.cs) (revision ccc77eb1d25d2f6e73e7b6547f2cc87b4d077713) +++ Ringtoets/Common/src/Ringtoets.Common.Service/AssemblyTool/AssemblyToolCategoriesCalculationService.cs (.../AssemblyToolCategoriesCalculationService.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; -using Ringtoets.AssemblyTool.Data.Output; using Ringtoets.AssemblyTool.KernelWrapper.Calculators; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; @@ -39,25 +38,17 @@ /// /// Calculates the assessment section assembly categories. /// - /// The input to use in the calculation. + /// The signaling norm to use in the calculation. + /// The lower boundary norm to use in the calculation. /// An of . - /// Thrown when is null. - public static IEnumerable CalculateAssessmentSectionAssemblyCategories(AssemblyCategoryInput input) + public static IEnumerable CalculateAssessmentSectionAssemblyCategories(double signalingNorm, double lowerBoundaryNorm) { - if (input == null) - { - throw new ArgumentNullException(nameof(input)); - } - IAssemblyCategoriesCalculator calculator = AssemblyToolCalculatorFactory.Instance.CreateAssemblyCategoriesCalculator( AssemblyToolKernelWrapperFactory.Instance); try { - IEnumerable categories = calculator.CalculateAssessmentSectionCategories( - AssemblyCategoryInputConverter.Convert(input)); - - return AssemblyCategoryConverter.ConvertToAssessmentSectionAssemblyCategories(categories); + return calculator.CalculateAssessmentSectionCategories(signalingNorm, lowerBoundaryNorm); } catch (Exception e) when (e is AssemblyCategoriesCalculatorException || e is AssemblyCategoryConversionException) { Index: Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj =================================================================== diff -u -r64ff455bdc7d729c3b52ea59c2d347a5d3b1805d -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 64ff455bdc7d729c3b52ea59c2d347a5d3b1805d) +++ Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -15,8 +15,6 @@ - - Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Service.Test/AssemblyTool/AssemblyCategoryConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7f7cb92f29ad73708c2346df6efd1c39fc29d41c refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Service.Test/AssemblyTool/AssemblyCategoryInputConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/AssemblyTool/AssemblyToolCategoriesCalculationServiceTest.cs =================================================================== diff -u -r77da7f1567a6c758907e3a4a187c2698116a655b -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/AssemblyTool/AssemblyToolCategoriesCalculationServiceTest.cs (.../AssemblyToolCategoriesCalculationServiceTest.cs) (revision 77da7f1567a6c758907e3a4a187c2698116a655b) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/AssemblyTool/AssemblyToolCategoriesCalculationServiceTest.cs (.../AssemblyToolCategoriesCalculationServiceTest.cs) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -25,12 +25,11 @@ using Core.Common.TestUtil; using log4net.Core; using NUnit.Framework; -using Ringtoets.AssemblyTool.Data.Input; -using Ringtoets.AssemblyTool.Data.Output; using Ringtoets.AssemblyTool.KernelWrapper.Calculators; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels; using Ringtoets.Common.Data.AssemblyTool; using Ringtoets.Common.Data.Exceptions; using Ringtoets.Common.Service.AssemblyTool; @@ -41,17 +40,6 @@ public class AssemblyToolCategoriesCalculationServiceTest { [Test] - public void CalculateAssessmentSectionAssemblyCategories_InputNull_ThrowsArgumentNullException() - { - // Call - TestDelegate call = () => AssemblyToolCategoriesCalculationService.CalculateAssessmentSectionAssemblyCategories(null); - - // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("input", exception.ParamName); - } - - [Test] public void CalculateAssessmentSectionAssemblyCategories_WithInput_SetsInputOnCalculator() { // Setup @@ -66,12 +54,11 @@ AssemblyCategoriesCalculatorStub calculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator; // Call - AssemblyToolCategoriesCalculationService.CalculateAssessmentSectionAssemblyCategories(input); + AssemblyToolCategoriesCalculationService.CalculateAssessmentSectionAssemblyCategories(input.SignalingNorm, input.LowerBoundaryNorm); // Assert - AssemblyCategoriesCalculatorInput actualInput = calculator.Input; - Assert.AreEqual(signalingNorm, actualInput.SignalingNorm); - Assert.AreEqual(lowerBoundaryNorm, actualInput.LowerBoundaryNorm); + Assert.AreEqual(signalingNorm, calculator.SignalingNorm); + Assert.AreEqual(lowerBoundaryNorm, calculator.LowerBoundaryNorm); } } @@ -90,15 +77,15 @@ AssemblyCategoriesCalculatorStub calculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator; // Call - AssessmentSectionAssemblyCategory[] output = AssemblyToolCategoriesCalculationService.CalculateAssessmentSectionAssemblyCategories(input).ToArray(); + AssessmentSectionAssemblyCategory[] output = AssemblyToolCategoriesCalculationService.CalculateAssessmentSectionAssemblyCategories(input.SignalingNorm, input.LowerBoundaryNorm).ToArray(); // Assert - AssessmentSectionAssemblyCategoryResult[] calculatorOutput = calculator.AssessmentSectionCategoriesOutput.ToArray(); + AssessmentSectionAssemblyCategory[] calculatorOutput = calculator.AssessmentSectionCategoriesOutput.ToArray(); Assert.AreEqual(calculatorOutput.Length, output.Length); CollectionAssert.AreEqual(calculatorOutput.Select(co => co.LowerBoundary), output.Select(o => o.LowerBoundary)); CollectionAssert.AreEqual(calculatorOutput.Select(co => co.UpperBoundary), output.Select(o => o.UpperBoundary)); - CollectionAssert.AreEqual(calculatorOutput.Select(co => GetAssessmentSectionAssemblyCategoryType(co.Category)), output.Select(o => o.Group)); + CollectionAssert.AreEqual(calculatorOutput.Select(co => co.Group), output.Select(o => o.Group)); } } @@ -116,7 +103,7 @@ // Call IEnumerable output = null; - Action test = () => output = AssemblyToolCategoriesCalculationService.CalculateAssessmentSectionAssemblyCategories(input); + Action test = () => output = AssemblyToolCategoriesCalculationService.CalculateAssessmentSectionAssemblyCategories(input.SignalingNorm, input.LowerBoundaryNorm); // Assert TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(test, tuples => @@ -132,59 +119,5 @@ CollectionAssert.IsEmpty(output); } } - - [Test] - public void CalculateAssessmentSectionAssemblyCategories_ErrorInConversion_LogErrorAndReturnEmptyOutput() - { - // Setup - var input = new AssemblyCategoryInput(0, 0); - - using (new AssemblyToolCalculatorFactoryConfig()) - { - var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; - AssemblyCategoriesCalculatorStub calculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator; - calculator.AssessmentSectionCategoriesOutput = new[] - { - new AssessmentSectionAssemblyCategoryResult(0, 1, (AssessmentSectionAssemblyCategoryResultType) 99) - }; - - // Call - IEnumerable output = null; - Action test = () => output = AssemblyToolCategoriesCalculationService.CalculateAssessmentSectionAssemblyCategories(input); - - // Assert - TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(test, tuples => - { - Tuple[] messages = tuples as Tuple[] ?? tuples.ToArray(); - Assert.AreEqual(1, messages.Length); - - Tuple tuple1 = messages[0]; - Assert.AreEqual("Er is een onverwachte fout opgetreden bij het bepalen van categoriegrenzen.", tuple1.Item1); - Assert.AreEqual(Level.Error, tuple1.Item2); - Assert.IsInstanceOf(tuple1.Item3); - }); - CollectionAssert.IsEmpty(output); - } - } - - private static AssessmentSectionAssemblyCategoryGroup GetAssessmentSectionAssemblyCategoryType( - AssessmentSectionAssemblyCategoryResultType categoryType) - { - switch (categoryType) - { - case AssessmentSectionAssemblyCategoryResultType.APlus: - return AssessmentSectionAssemblyCategoryGroup.APlus; - case AssessmentSectionAssemblyCategoryResultType.A: - return AssessmentSectionAssemblyCategoryGroup.A; - case AssessmentSectionAssemblyCategoryResultType.B: - return AssessmentSectionAssemblyCategoryGroup.B; - case AssessmentSectionAssemblyCategoryResultType.C: - return AssessmentSectionAssemblyCategoryGroup.C; - case AssessmentSectionAssemblyCategoryResultType.D: - return AssessmentSectionAssemblyCategoryGroup.D; - default: - throw new NotSupportedException(); - } - } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj =================================================================== diff -u -r64ff455bdc7d729c3b52ea59c2d347a5d3b1805d -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj (.../Ringtoets.Common.Service.Test.csproj) (revision 64ff455bdc7d729c3b52ea59c2d347a5d3b1805d) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj (.../Ringtoets.Common.Service.Test.csproj) (revision 7f7cb92f29ad73708c2346df6efd1c39fc29d41c) @@ -27,8 +27,6 @@ - - Index: lib/Plugins/AssemblyTool/AssemblyToolKernel.dll =================================================================== diff -u -r3a8403a97075c7278df6c63f29de24b2b61757be -r7f7cb92f29ad73708c2346df6efd1c39fc29d41c Binary files differ