Fisheye: Tag 72df6d513fff09ec6bae83f2885e3d7221f9a3c9 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 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Input/AssemblyCategoryBoundariesCalculatorInput.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/AssemblyCategoryBoundariesResult.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/AssemblyCategoryResult.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/AssemblyCategoryResult.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/AssemblyCategoryResult.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,49 @@ +// 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. + +namespace Ringtoets.AssemblyTool.Data.Output +{ + /// + /// Base class of the assembly category result of an assembly categories calculation. + /// + public abstract class AssemblyCategoryResult + { + /// + /// Creates a new instance of . + /// + /// The lower boundary of the category. + /// The upper boundary of the category. + protected AssemblyCategoryResult(double lowerBoundary, double upperBoundary) + { + LowerBoundary = lowerBoundary; + UpperBoundary = upperBoundary; + } + /// + /// Gets the lower boundary of the assembly category. + /// + public double LowerBoundary { get; } + + /// + /// Gets the upper boundary of the assembly category. + /// + public double UpperBoundary { get; } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/AssessmentSectionAssemblyCategoryResult.cs =================================================================== diff -u -r14897fbd46c7c1b5f5c087d88a470688558fe890 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/AssessmentSectionAssemblyCategoryResult.cs (.../AssessmentSectionAssemblyCategoryResult.cs) (revision 14897fbd46c7c1b5f5c087d88a470688558fe890) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/AssessmentSectionAssemblyCategoryResult.cs (.../AssessmentSectionAssemblyCategoryResult.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -25,20 +25,20 @@ namespace Ringtoets.AssemblyTool.Data.Output { /// - /// The assembly category result of an assessment section category boundaries calculation. + /// The assembly category result of an assessment section categories calculation. /// - public class AssessmentSectionAssemblyCategoryResult : IAssemblyCategoryResult + public class AssessmentSectionAssemblyCategoryResult : AssemblyCategoryResult { /// /// Creates a new instance of . /// - /// The category type of the result. /// The lower boundary of the category. /// The upper boundary of the category. + /// The category type of the result. /// Thrown when /// contains an invalid value. - public AssessmentSectionAssemblyCategoryResult(AssessmentSectionAssemblyCategoryResultType category, - double lowerBoundary, double upperBoundary) + public AssessmentSectionAssemblyCategoryResult(double lowerBoundary, double upperBoundary, AssessmentSectionAssemblyCategoryResultType category) + : base(lowerBoundary, upperBoundary) { if (!Enum.IsDefined(typeof(AssessmentSectionAssemblyCategoryResultType), category)) { @@ -48,17 +48,11 @@ } Category = category; - LowerBoundary = lowerBoundary; - UpperBoundary = upperBoundary; } /// /// Gets the category type of the result. /// public AssessmentSectionAssemblyCategoryResultType Category { get; } - - public double LowerBoundary { get; } - - public double UpperBoundary { get; } } } \ No newline at end of file Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Output/IAssemblyCategoryResult.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Ringtoets.AssemblyTool.Data.csproj =================================================================== diff -u -r72df6d513fff09ec6bae83f2885e3d7221f9a3c9 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Ringtoets.AssemblyTool.Data.csproj (.../Ringtoets.AssemblyTool.Data.csproj) (revision 72df6d513fff09ec6bae83f2885e3d7221f9a3c9) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Data/Ringtoets.AssemblyTool.Data.csproj (.../Ringtoets.AssemblyTool.Data.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -11,11 +11,10 @@ - - + - + Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/AssemblyToolCalculatorFactory.cs =================================================================== diff -u -rb3257a49b725571baf179cc551d384d762e16942 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/AssemblyToolCalculatorFactory.cs (.../AssemblyToolCalculatorFactory.cs) (revision b3257a49b725571baf179cc551d384d762e16942) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/AssemblyToolCalculatorFactory.cs (.../AssemblyToolCalculatorFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -20,7 +20,7 @@ // All rights reserved. using System; -using Ringtoets.AssemblyTool.KernelWrapper.Calculators.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; namespace Ringtoets.AssemblyTool.KernelWrapper.Calculators @@ -49,9 +49,9 @@ } } - public IAssemblyCategoryBoundariesCalculator CreateAssemblyCategoryBoundariesCalculator(IAssemblyToolKernelFactory factory) + public IAssemblyCategoriesCalculator CreateAssemblyCategoriesCalculator(IAssemblyToolKernelFactory factory) { - return new AssemblyCategoryBoundariesCalculator(factory); + return new AssemblyCategoriesCalculator(factory); } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/AssemblyCategoriesCalculator.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/AssemblyCategoriesCalculator.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/AssemblyCategoriesCalculator.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,69 @@ +// 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 AssemblyTool.Kernel; +using AssemblyTool.Kernel.CategoriesOutput; +using Ringtoets.AssemblyTool.Data.Input; +using Ringtoets.AssemblyTool.Data.Output; +using Ringtoets.AssemblyTool.KernelWrapper.Creators; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories +{ + /// + /// Class representing an assembly categories calculator. + /// + public class AssemblyCategoriesCalculator : IAssemblyCategoriesCalculator + { + private readonly IAssemblyToolKernelFactory factory; + + /// + /// Creates a new instance of . + /// + /// The factory responsible for creating the assembly categories kernel. + /// Thrown when any parameter is null. + public AssemblyCategoriesCalculator(IAssemblyToolKernelFactory factory) + { + if (factory == null) + { + throw new ArgumentNullException(nameof(factory)); + } + this.factory = factory; + } + + public IEnumerable CalculateAssessmentSectionCategories( + AssemblyCategoriesCalculatorInput input) + { + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + IAssemblyCategoriesKernel kernel = factory.CreateAssemblyCategoriesKernel(); + CalculationOutput output = kernel.Calculate(input.SignalingNorm, input.LowerBoundaryNorm); + + return AssemblyCategoryResultCreator.CreateAssessmentSectionAssemblyCategoryResult(output); + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,53 @@ +// 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 Ringtoets.AssemblyTool.Data.Input; +using Ringtoets.AssemblyTool.Data.Output; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories +{ + /// + /// Interface representing an assembly categories calculator. + /// + /// + /// This interface is introduced for being able to test the conversion of: + /// + /// Ringtoets assembly categories input into calculator input; + /// calculator output into Ringtoets assembly categories output. + /// + /// + public interface IAssemblyCategoriesCalculator + { + /// + /// Performs the calculation for getting the assessment section categories. + /// + /// The containing + /// all the values required for performing the assembly categories calculation. + /// An with categories of + /// . + /// Thrown when + /// is null. + IEnumerable CalculateAssessmentSectionCategories( + AssemblyCategoriesCalculatorInput input); + } +} \ No newline at end of file Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/CategoryBoundaries/AssemblyCategoryBoundariesCalculator.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/CategoryBoundaries/IAssemblyCategoryBoundariesCalculator.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/IAssemblyToolCalculatorFactory.cs =================================================================== diff -u -rb3257a49b725571baf179cc551d384d762e16942 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/IAssemblyToolCalculatorFactory.cs (.../IAssemblyToolCalculatorFactory.cs) (revision b3257a49b725571baf179cc551d384d762e16942) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/IAssemblyToolCalculatorFactory.cs (.../IAssemblyToolCalculatorFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -20,7 +20,7 @@ // All rights reserved. using System; -using Ringtoets.AssemblyTool.KernelWrapper.Calculators.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; namespace Ringtoets.AssemblyTool.KernelWrapper.Calculators @@ -31,11 +31,11 @@ public interface IAssemblyToolCalculatorFactory { /// - /// Creates an assembly category boundaries calculator. + /// Creates an assembly categories calculator. /// - /// The factory responsible for creating the assembly category boundaries kernel. - /// The assembly category boundaries calculator. + /// The factory responsible for creating the assembly categories kernel. + /// The assembly categories calculator. /// Thrown when is null. - IAssemblyCategoryBoundariesCalculator CreateAssemblyCategoryBoundariesCalculator(IAssemblyToolKernelFactory factory); + IAssemblyCategoriesCalculator CreateAssemblyCategoriesCalculator(IAssemblyToolKernelFactory factory); } } \ No newline at end of file Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssemblyCategoryBoundariesResultCreator.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssemblyCategoryResultCreator.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssemblyCategoryResultCreator.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssemblyCategoryResultCreator.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -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.CategoriesOutput; +using AssemblyTool.Kernel.Data; +using Ringtoets.AssemblyTool.Data.Output; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Creators +{ + /// + /// Creates instances. + /// + internal static class AssemblyCategoryResultCreator + { + /// + /// 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 CreateAssessmentSectionAssemblyCategoryResult( + CalculationOutput output) + { + if (output == null) + { + throw new ArgumentNullException(nameof(output)); + } + + return output.Result.Select( + categoriesOutput => new AssessmentSectionAssemblyCategoryResult(categoriesOutput.LowerBoundary, + categoriesOutput.UpperBoundary, ConvertAssessmentSectionCategoryType(categoriesOutput.Category))).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 AssessmentSectionAssemblyCategoryResultType ConvertAssessmentSectionCategoryType(AssessmentSectionAssemblyCategory category) + { + if (!Enum.IsDefined(typeof(AssessmentSectionAssemblyCategory), category)) + { + throw new InvalidEnumArgumentException(nameof(category), + (int) category, + typeof(AssessmentSectionAssemblyCategory)); + } + + switch (category) + { + case AssessmentSectionAssemblyCategory.APlus: + return AssessmentSectionAssemblyCategoryResultType.APlus; + case AssessmentSectionAssemblyCategory.A: + return AssessmentSectionAssemblyCategoryResultType.A; + case AssessmentSectionAssemblyCategory.B: + return AssessmentSectionAssemblyCategoryResultType.B; + case AssessmentSectionAssemblyCategory.C: + return AssessmentSectionAssemblyCategoryResultType.C; + case AssessmentSectionAssemblyCategory.D: + return AssessmentSectionAssemblyCategoryResultType.D; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/AssemblyToolKernelWrapperFactory.cs =================================================================== diff -u -r2edcd7944ce0d87b3299baa2887ab67a3cfe15e3 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/AssemblyToolKernelWrapperFactory.cs (.../AssemblyToolKernelWrapperFactory.cs) (revision 2edcd7944ce0d87b3299baa2887ab67a3cfe15e3) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/AssemblyToolKernelWrapperFactory.cs (.../AssemblyToolKernelWrapperFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -20,7 +20,7 @@ // All rights reserved. using System; -using Ringtoets.AssemblyTool.KernelWrapper.Kernels.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; namespace Ringtoets.AssemblyTool.KernelWrapper.Kernels { @@ -45,9 +45,9 @@ } } - public IAssemblyCategoryBoundariesKernel CreateAssemblyCategoryBoundariesKernel() + public IAssemblyCategoriesKernel CreateAssemblyCategoriesKernel() { - return new AssemblyCategoryBoundariesKernelWrapper(); + return new AssemblyCategoriesKernelWrapper(); } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/Categories/AssemblyCategoriesKernelWrapper.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/Categories/AssemblyCategoriesKernelWrapper.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/Categories/AssemblyCategoriesKernelWrapper.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,37 @@ +// 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 AssemblyTool.Kernel; +using AssemblyTool.Kernel.CategoriesOutput; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories +{ + /// + /// Class that wraps assembly kernel for performing an assembly categories calculation. + /// + internal class AssemblyCategoriesKernelWrapper : IAssemblyCategoriesKernel + { + public CalculationOutput Calculate(double signalingNorm, double lowerBoundaryNorm) + { + return CategoriesCalculator.CalculateAssessmentSectionCategories(signalingNorm, lowerBoundaryNorm); + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/Categories/IAssemblyCategoriesKernel.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/Categories/IAssemblyCategoriesKernel.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/Categories/IAssemblyCategoriesKernel.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,48 @@ +// 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 AssemblyTool.Kernel; +using AssemblyTool.Kernel.CategoriesOutput; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories +{ + /// + /// Interface representing assembly categories kernel input, methods and output. + /// + /// + /// This interface is introduced for being able to test the conversion of: + /// + /// input into kernel input; + /// kernel output into output. + /// + /// + public interface IAssemblyCategoriesKernel + { + /// + /// Performs the calculation. + /// + /// The signaling norm to use in the calculation. + /// The lower boundary norm to use in the calculation. + /// The calculation output. + CalculationOutput Calculate(double signalingNorm, double lowerBoundaryNorm); + } +} \ No newline at end of file Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/CategoryBoundaries/AssemblyCategoryBoundariesKernelWrapper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/CategoryBoundaries/IAssemblyCategoryBoundariesKernel.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/IAssemblyToolKernelFactory.cs =================================================================== diff -u -rbc85d5aa0b1c0eefd837eb1f12b392305ab7a45e -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/IAssemblyToolKernelFactory.cs (.../IAssemblyToolKernelFactory.cs) (revision bc85d5aa0b1c0eefd837eb1f12b392305ab7a45e) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Kernels/IAssemblyToolKernelFactory.cs (.../IAssemblyToolKernelFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -19,7 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using Ringtoets.AssemblyTool.KernelWrapper.Kernels.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; namespace Ringtoets.AssemblyTool.KernelWrapper.Kernels { @@ -29,9 +29,9 @@ public interface IAssemblyToolKernelFactory { /// - /// Creates an assembly category boundaries kernel. + /// Creates an assembly categories kernel. /// - /// A new . - IAssemblyCategoryBoundariesKernel CreateAssemblyCategoryBoundariesKernel(); + /// A new . + IAssemblyCategoriesKernel CreateAssemblyCategoriesKernel(); } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Ringtoets.AssemblyTool.KernelWrapper.csproj =================================================================== diff -u -r9639088b551acfa88a2938629666025d474c77f6 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Ringtoets.AssemblyTool.KernelWrapper.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.csproj) (revision 9639088b551acfa88a2938629666025d474c77f6) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Ringtoets.AssemblyTool.KernelWrapper.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -15,13 +15,13 @@ - - + + - + - - + + Fisheye: Tag 72df6d513fff09ec6bae83f2885e3d7221f9a3c9 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 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Input/AssemblyCategoryBoundariesCalculatorInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Output/AssemblyCategoryBoundariesResultTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Output/AssemblyCategoryResultTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Output/AssemblyCategoryResultTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Output/AssemblyCategoryResultTest.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,53 @@ +// 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 NUnit.Framework; +using Ringtoets.AssemblyTool.Data.Output; + +namespace Ringtoets.AssemblyTool.Data.Test.Output +{ + [TestFixture] + public class AssemblyCategoryResultTest + { + [Test] + public void Constructor_ExpectedValues() + { + var random = new Random(11); + + double lowerBoundary = random.NextDouble(); + double upperBoundary = random.NextDouble(); + + // Call + var category = new SimpleCategoryResult(lowerBoundary, upperBoundary); + + // Assert + Assert.AreEqual(lowerBoundary, category.LowerBoundary); + Assert.AreEqual(upperBoundary, category.UpperBoundary); + } + + private class SimpleCategoryResult : AssemblyCategoryResult + { + public SimpleCategoryResult(double lowerBoundary, double upperBoundary) + : base(lowerBoundary, upperBoundary) {} + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Output/AssessmentSectionAssemblyCategoryResultTest.cs =================================================================== diff -u -r14897fbd46c7c1b5f5c087d88a470688558fe890 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Output/AssessmentSectionAssemblyCategoryResultTest.cs (.../AssessmentSectionAssemblyCategoryResultTest.cs) (revision 14897fbd46c7c1b5f5c087d88a470688558fe890) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Output/AssessmentSectionAssemblyCategoryResultTest.cs (.../AssessmentSectionAssemblyCategoryResultTest.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -34,7 +34,7 @@ public void Constructor_InvalidAssessmentSectionAssemblyCategoryResultType_ThrowsInvalidEnumArgumentException() { // Call - TestDelegate test = () => new AssessmentSectionAssemblyCategoryResult((AssessmentSectionAssemblyCategoryResultType) 99, 0, 0); + TestDelegate test = () => new AssessmentSectionAssemblyCategoryResult(0, 0, (AssessmentSectionAssemblyCategoryResultType) 99); // Assert const string expectedMessage = "The value of argument 'category' (99) is invalid for Enum type 'AssessmentSectionAssemblyCategoryResultType'."; @@ -46,18 +46,14 @@ { // Setup var random = new Random(11); - double lowerBoundary = random.Next(); - double upperBoundary = random.Next(); var category = random.NextEnumValue(); // Call - var categoryResult = new AssessmentSectionAssemblyCategoryResult(category, lowerBoundary, upperBoundary); + var categoryResult = new AssessmentSectionAssemblyCategoryResult(0, 0, category); // Assert - Assert.IsInstanceOf(categoryResult); + Assert.IsInstanceOf(categoryResult); Assert.AreEqual(category, categoryResult.Category); - Assert.AreEqual(lowerBoundary, categoryResult.LowerBoundary); - Assert.AreEqual(upperBoundary, categoryResult.UpperBoundary); } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Ringtoets.AssemblyTool.Data.Test.csproj =================================================================== diff -u -r72df6d513fff09ec6bae83f2885e3d7221f9a3c9 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Ringtoets.AssemblyTool.Data.Test.csproj (.../Ringtoets.AssemblyTool.Data.Test.csproj) (revision 72df6d513fff09ec6bae83f2885e3d7221f9a3c9) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Data.Test/Ringtoets.AssemblyTool.Data.Test.csproj (.../Ringtoets.AssemblyTool.Data.Test.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -14,8 +14,8 @@ - - + + Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/AssemblyCategoryBoundariesResultAssert.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/AssemblyCategoryResultAssert.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/AssemblyCategoryResultAssert.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/AssemblyCategoryResultAssert.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,74 @@ +// 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.CategoriesOutput; +using AssemblyTool.Kernel.Data; +using NUnit.Framework; +using Ringtoets.AssemblyTool.Data.Output; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Test +{ + /// + /// Class for asserting categories result. + /// + public static class AssemblyCategoryResultAssert + { + /// + /// Asserts whether is equal to . + /// + /// The original . + /// The actual . + /// Thrown when + /// is not equal to . + public static void AssertAssessmentSectionAssemblyCategoriesResult(CalculationOutput original, + IEnumerable actual) + { + Assert.AreEqual(original.Result.Length, actual.Count()); + + CollectionAssert.AreEqual(original.Result.Select(o => GetResultType(o.Category)), actual.Select(r => r.Category)); + 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 AssessmentSectionAssemblyCategoryResultType GetResultType(AssessmentSectionAssemblyCategory category) + { + switch (category) + { + case AssessmentSectionAssemblyCategory.APlus: + return AssessmentSectionAssemblyCategoryResultType.APlus; + case AssessmentSectionAssemblyCategory.A: + return AssessmentSectionAssemblyCategoryResultType.A; + case AssessmentSectionAssemblyCategory.B: + return AssessmentSectionAssemblyCategoryResultType.B; + case AssessmentSectionAssemblyCategory.C: + return AssessmentSectionAssemblyCategoryResultType.C; + case AssessmentSectionAssemblyCategory.D: + return AssessmentSectionAssemblyCategoryResultType.D; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/AssemblyToolCalculatorFactoryTest.cs =================================================================== diff -u -rb3257a49b725571baf179cc551d384d762e16942 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/AssemblyToolCalculatorFactoryTest.cs (.../AssemblyToolCalculatorFactoryTest.cs) (revision b3257a49b725571baf179cc551d384d762e16942) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/AssemblyToolCalculatorFactoryTest.cs (.../AssemblyToolCalculatorFactoryTest.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -21,7 +21,7 @@ using NUnit.Framework; using Ringtoets.AssemblyTool.KernelWrapper.Calculators; -using Ringtoets.AssemblyTool.KernelWrapper.Calculators.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels; @@ -70,19 +70,19 @@ } [Test] - public void CreateAssemblyCategoryBoundariesCalculator_WithCalculatorInput_ReturnsAssemblyCategoryBoundariesCalculator() + public void CreateAssemblyCategoriesCalculator_WithCalculatorInput_ReturnsAssemblyCategoriesCalculator() { // Setup IAssemblyToolCalculatorFactory factory = AssemblyToolCalculatorFactory.Instance; using (new AssemblyToolKernelFactoryConfig()) { // Call - IAssemblyCategoryBoundariesCalculator calculator = factory.CreateAssemblyCategoryBoundariesCalculator( + IAssemblyCategoriesCalculator calculator = factory.CreateAssemblyCategoriesCalculator( AssemblyToolKernelWrapperFactory.Instance); // Assert - Assert.IsInstanceOf(calculator); + Assert.IsInstanceOf(calculator); } } } Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Categories/AssemblyCategoriesCalculatorTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Categories/AssemblyCategoriesCalculatorTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Categories/AssemblyCategoriesCalculatorTest.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,153 @@ +// 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 AssemblyTool.Kernel; +using AssemblyTool.Kernel.CategoriesOutput; +using AssemblyTool.Kernel.Data; +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.TestUtil.Kernels; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels.Categories; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Test.Calculators.Categories +{ + [TestFixture] + public class AssemblyCategoriesCalculatorTest + { + [Test] + public void Constructor_FactoryNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new AssemblyCategoriesCalculator(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("factory", exception.ParamName); + } + + [Test] + public void Constructor_ValidParameters_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var factory = mocks.Stub(); + mocks.ReplayAll(); + + // Call + var calculator = new AssemblyCategoriesCalculator(factory); + + // Assert + Assert.IsInstanceOf(calculator); + mocks.VerifyAll(); + } + + [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()) + { + var factory = (TestAssemblyToolKernelFactory) AssemblyToolKernelWrapperFactory.Instance; + AssemblyCategoriesKernelStub kernel = factory.LastCreatedAssemblyCategoriesKernel; + kernel.AssessmentSectionCategoriesOutput = CreateKernelOutput(); + + var calculator = new AssemblyCategoriesCalculator(factory); + + // Call + calculator.CalculateAssessmentSectionCategories(input); + + // Assert + Assert.AreEqual(lowerBoundaryNorm, kernel.LowerBoundaryNorm); + Assert.AreEqual(signalingNorm, kernel.SignalingNorm); + } + } + + [Test] + public void CalculateAssessmentSectionCategories_KernelWithCompleteOutput_OutputCorrectlyReturnedByCalculator() + { + // Setup + var random = new Random(11); + double lowerBoundaryNorm = random.NextDouble(); + double signalingNorm = random.NextDouble(); + var input = new AssemblyCategoriesCalculatorInput(signalingNorm, lowerBoundaryNorm); + CalculationOutput output = CreateKernelOutput(); + + using (new AssemblyToolKernelFactoryConfig()) + { + var factory = (TestAssemblyToolKernelFactory)AssemblyToolKernelWrapperFactory.Instance; + AssemblyCategoriesKernelStub kernel = factory.LastCreatedAssemblyCategoriesKernel; + kernel.AssessmentSectionCategoriesOutput = output; + + var calculator = new AssemblyCategoriesCalculator(factory); + + // Call + IEnumerable result = calculator.CalculateAssessmentSectionCategories(input); + + // Assert + AssemblyCategoryResultAssert.AssertAssessmentSectionAssemblyCategoriesResult(output, result); + } + } + + private static CalculationOutput CreateKernelOutput() + { + var random = new Random(11); + + 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)) + }); + } + } +} \ No newline at end of file Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/CategoryBoundaries/AssemblyCategoryBoundariesCalculatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssemblyCategoryBoundariesResultCreatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssemblyCategoryResultCreatorTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssemblyCategoryResultCreatorTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssemblyCategoryResultCreatorTest.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -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.CategoriesOutput; +using AssemblyTool.Kernel.Data; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.AssemblyTool.Data.Output; +using Ringtoets.AssemblyTool.KernelWrapper.Creators; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Test.Creators +{ + [TestFixture] + public class AssemblyCategoryResultCreatorTest + { + [Test] + public void CreateAssessmentSectionResult_OutputNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => AssemblyCategoryResultCreator.CreateAssessmentSectionAssemblyCategoryResult(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("output", exception.ParamName); + } + + [Test] + public void CreateAssessmentSectionResult_WithOutput_ReturnAssessmentSectionAssemblyCategoryResult() + { + // Setup + var random = new Random(11); + + var output = 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)) + }); + + // Call + IEnumerable result = AssemblyCategoryResultCreator.CreateAssessmentSectionAssemblyCategoryResult(output); + + // Assert + AssemblyCategoryResultAssert.AssertAssessmentSectionAssemblyCategoriesResult(output, result); + } + + [Test] + public void CreateAssessmentSectionResult_CategoryWithInvalidAssessmentSectionAssemblyCategory_ThrowsInvalidEnumArgumentException() + { + // Setup + var output = new CalculationOutput(new[] + { + new AssessmentSectionCategoriesOutput((AssessmentSectionAssemblyCategory) 99, 0, 0) + }); + + // Call + TestDelegate test = () => AssemblyCategoryResultCreator.CreateAssessmentSectionAssemblyCategoryResult(output); + + // Assert + const string exceptionMessage = "The value of argument 'category' (99) is invalid for Enum type 'AssessmentSectionAssemblyCategory'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, exceptionMessage); + } + + [Test] + [TestCase(AssessmentSectionAssemblyCategory.APlus, AssessmentSectionAssemblyCategoryResultType.APlus)] + [TestCase(AssessmentSectionAssemblyCategory.A, AssessmentSectionAssemblyCategoryResultType.A)] + [TestCase(AssessmentSectionAssemblyCategory.B, AssessmentSectionAssemblyCategoryResultType.B)] + [TestCase(AssessmentSectionAssemblyCategory.C, AssessmentSectionAssemblyCategoryResultType.C)] + [TestCase(AssessmentSectionAssemblyCategory.D, AssessmentSectionAssemblyCategoryResultType.D)] + public void CreateAssessmentSectionResult_CategoryWithValidAssessmentSectionAssemblyCategory_ExpectedAssessmentSectionAssemblyCategoryResultType( + AssessmentSectionAssemblyCategory category, + AssessmentSectionAssemblyCategoryResultType expectedCategoryResultType) + { + // Setup + var output = new CalculationOutput(new[] + { + new AssessmentSectionCategoriesOutput(category, 0, 0) + }); + + // Call + IEnumerable result = AssemblyCategoryResultCreator.CreateAssessmentSectionAssemblyCategoryResult(output); + + // Assert + Assert.AreEqual(1, result.Count()); + AssessmentSectionAssemblyCategoryResult categoryResult = result.First(); + + Assert.AreEqual(expectedCategoryResultType, categoryResult.Category); + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/AssemblyToolKernelWrapperFactoryTest.cs =================================================================== diff -u -r2edcd7944ce0d87b3299baa2887ab67a3cfe15e3 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/AssemblyToolKernelWrapperFactoryTest.cs (.../AssemblyToolKernelWrapperFactoryTest.cs) (revision 2edcd7944ce0d87b3299baa2887ab67a3cfe15e3) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/AssemblyToolKernelWrapperFactoryTest.cs (.../AssemblyToolKernelWrapperFactoryTest.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -21,7 +21,7 @@ using NUnit.Framework; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; -using Ringtoets.AssemblyTool.KernelWrapper.Kernels.CategoryBoundaries; +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 CreateAssemblyCategoryBoundariesKernel_Always_ReturnsAssemblyCategoryBoundariesKernelWrapper() + public void CreateAssemblyCategoriesKernel_Always_ReturnsAssemblyCategoriesKernelWrapper() { // Setup IAssemblyToolKernelFactory factory = AssemblyToolKernelWrapperFactory.Instance; // Call - IAssemblyCategoryBoundariesKernel assemblyCategoryBoundariesKernel = factory.CreateAssemblyCategoryBoundariesKernel(); + IAssemblyCategoriesKernel assemblyCategoriesKernel = factory.CreateAssemblyCategoriesKernel(); // Assert - Assert.IsInstanceOf(assemblyCategoryBoundariesKernel); + Assert.IsInstanceOf(assemblyCategoriesKernel); } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/Categories/AssemblyCategoriesKernelWrapperTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/Categories/AssemblyCategoriesKernelWrapperTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/Categories/AssemblyCategoriesKernelWrapperTest.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,55 @@ +// 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 AssemblyTool.Kernel; +using AssemblyTool.Kernel.CategoriesOutput; +using NUnit.Framework; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; + +namespace Ringtoets.AssemblyTool.KernelWrapper.Test.Kernels.CategoryBoundaries +{ + [TestFixture] + public class AssemblyCategoriesKernelWrapperTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var kernelWrapper = new AssemblyCategoriesKernelWrapper(); + + // Assert + Assert.IsInstanceOf(kernelWrapper); + } + + [Test] + public void Calculate_Always_ReturnsOutput() + { + // Setup + var kernelWrapper = new AssemblyCategoriesKernelWrapper(); + + // Call + CalculationOutput output = kernelWrapper.Calculate(0, 0); + + // Assert + Assert.IsNotNull(output); + } + } +} \ No newline at end of file Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Kernels/CategoryBoundaries/AssemblyCategoryBoundariesKernelWrapperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Ringtoets.AssemblyTool.KernelWrapper.Test.csproj =================================================================== diff -u -rfb7cdba72f870210afaccb9261ff23b9661dd8eb -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Ringtoets.AssemblyTool.KernelWrapper.Test.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.Test.csproj) (revision fb7cdba72f870210afaccb9261ff23b9661dd8eb) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Ringtoets.AssemblyTool.KernelWrapper.Test.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.Test.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -20,12 +20,12 @@ - + - - + + - + Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,58 @@ +// 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.Collections.Generic; +using NUnit.Framework; +using Ringtoets.AssemblyTool.Data.Output; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories; + +namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.Calculators.Categories +{ + [TestFixture] + public class AssemblyCategoriesCalculatorStubTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var calculator = new AssemblyCategoriesCalculatorStub(); + + // Assert + Assert.IsInstanceOf(calculator); + Assert.IsNull(calculator.Input); + Assert.IsNull(calculator.AssessmentSectionCategoriesOutput); + } + + [Test] + public void CalculateAssessmentSectionCategories_Always_ReturnEmptyCategories() + { + // Setup + var calculator = new AssemblyCategoriesCalculatorStub(); + + // Call + IEnumerable result = calculator.CalculateAssessmentSectionCategories(null); + + // Assert + CollectionAssert.IsEmpty(result); + } + } +} \ No newline at end of file Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/CategoryBoundaries/AssemblyCategoryBoundariesCalculatorStubTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs =================================================================== diff -u -rb3257a49b725571baf179cc551d384d762e16942 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs (.../TestAssemblyToolCalculatorFactoryTest.cs) (revision b3257a49b725571baf179cc551d384d762e16942) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs (.../TestAssemblyToolCalculatorFactoryTest.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -21,10 +21,10 @@ using NUnit.Framework; using Ringtoets.AssemblyTool.KernelWrapper.Calculators; -using Ringtoets.AssemblyTool.KernelWrapper.Calculators.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators; -using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.Calculators @@ -40,24 +40,24 @@ // Assert Assert.IsInstanceOf(factory); - Assert.IsNotNull(factory.LastCreatedAssemblyCategoryBoundariesCalculator); - Assert.IsNull(factory.LastCreatedAssemblyCategoryBoundariesCalculator.Input); + Assert.IsNotNull(factory.LastCreatedAssemblyCategoriesCalculator); + Assert.IsNull(factory.LastCreatedAssemblyCategoriesCalculator.Input); } [Test] - public void CreateAssemblyCategoryBoundariesCalculator_Always_ReturnStubWithInputSet() + public void CreateAssemblyCategoriesCalculator_Always_ReturnStubWithInputSet() { // Setup var factory = new TestAssemblyToolCalculatorFactory(); using (new AssemblyToolKernelFactoryConfig()) { // Call - IAssemblyCategoryBoundariesCalculator calculator = factory.CreateAssemblyCategoryBoundariesCalculator( + IAssemblyCategoriesCalculator calculator = factory.CreateAssemblyCategoriesCalculator( AssemblyToolKernelWrapperFactory.Instance); // Assert - Assert.IsInstanceOf(calculator); + Assert.IsInstanceOf(calculator); } } } Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Categories/AssemblyCategoriesKernelStubTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Categories/AssemblyCategoriesKernelStubTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Categories/AssemblyCategoriesKernelStubTest.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,92 @@ +// 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 AssemblyTool.Kernel; +using AssemblyTool.Kernel.CategoriesOutput; +using NUnit.Framework; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels.Categories; + +namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.Kernels.Categories +{ + [TestFixture] + public class AssemblyCategoriesKernelStubTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var kernelStub = new AssemblyCategoriesKernelStub(); + + // Assert + Assert.IsInstanceOf(kernelStub); + Assert.IsFalse(kernelStub.Calculated); + } + + [Test] + public void Calculate_Always_InputCorrectlySetToKernel() + { + // Setup + var random = new Random(11); + double lowerBoundaryNorm = random.NextDouble(); + double signalingNorm = random.NextDouble(); + + var kernelStub = new AssemblyCategoriesKernelStub(); + + // Call + kernelStub.Calculate(signalingNorm, lowerBoundaryNorm); + + // Assert + Assert.AreEqual(signalingNorm, kernelStub.SignalingNorm); + Assert.AreEqual(lowerBoundaryNorm, kernelStub.LowerBoundaryNorm); + } + + [Test] + public void Calculate_Always_SetCalculatedTrue() + { + // Setup + var kernelStub = new AssemblyCategoriesKernelStub(); + + // Call + kernelStub.Calculate(0, 0); + + // Assert + Assert.IsTrue(kernelStub.Calculated); + } + + [Test] + public void Calculate_Always_ReturnAssessmentSectionCategoriesOutput() + { + // Setup + var kernelStub = new AssemblyCategoriesKernelStub + { + AssessmentSectionCategoriesOutput = new CalculationOutput(new AssessmentSectionCategoriesOutput[0]) + }; + + // Call + CalculationOutput output = kernelStub.Calculate(0, 0); + + // Assert + Assert.AreSame(kernelStub.AssessmentSectionCategoriesOutput, output); + } + } +} \ No newline at end of file Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/CategoryBoundaries/AssemblyCategoryBoundariesKernelStubTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/TestAssemblyToolKernelFactoryTest.cs =================================================================== diff -u -rac3bbab8cdfee2bee4faeea59a40240e79c20d33 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/TestAssemblyToolKernelFactoryTest.cs (.../TestAssemblyToolKernelFactoryTest.cs) (revision ac3bbab8cdfee2bee4faeea59a40240e79c20d33) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/TestAssemblyToolKernelFactoryTest.cs (.../TestAssemblyToolKernelFactoryTest.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -21,7 +21,7 @@ using NUnit.Framework; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; -using Ringtoets.AssemblyTool.KernelWrapper.Kernels.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.Kernels @@ -37,20 +37,20 @@ // Assert Assert.IsInstanceOf(factory); - Assert.IsNotNull(factory.LastCreatedAssemblyCategoryBoundariesKernel); + Assert.IsNotNull(factory.LastCreatedAssemblyCategoriesKernel); } [Test] - public void CreateAssemblyCategoryBoundariesKernel_Always_ReturnLastCreatedAssemblyCategoryBoundariesKernel() + public void CreateAssemblyCategoriesKernel_Always_ReturnLastCreatedAssemblyCategoriesKernel() { // Setup var factory = new TestAssemblyToolKernelFactory(); // Call - IAssemblyCategoryBoundariesKernel kernel = factory.CreateAssemblyCategoryBoundariesKernel(); + IAssemblyCategoriesKernel kernel = factory.CreateAssemblyCategoriesKernel(); // Assert - Assert.AreSame(factory.LastCreatedAssemblyCategoryBoundariesKernel, kernel); + Assert.AreSame(factory.LastCreatedAssemblyCategoriesKernel, kernel); } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.csproj =================================================================== diff -u -rc7b4f742050498460ce41e197815d0cd9addbc9d -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.csproj) (revision c7b4f742050498460ce41e197815d0cd9addbc9d) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -18,9 +18,9 @@ - + - + Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,51 @@ +// 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.Collections.Generic; +using Ringtoets.AssemblyTool.Data.Input; +using Ringtoets.AssemblyTool.Data.Output; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; + +namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories +{ + /// + /// Assembly categories calculator stub for testing purposes. + /// + public class AssemblyCategoriesCalculatorStub : IAssemblyCategoriesCalculator + { + /// + /// Gets or sets the assembly categories calculator input. + /// + public AssemblyCategoriesCalculatorInput Input { get; set; } + + /// + /// Gets the output of the calculation. + /// + public IEnumerable AssessmentSectionCategoriesOutput { get; private set; } + + public IEnumerable CalculateAssessmentSectionCategories( + AssemblyCategoriesCalculatorInput input) + { + return AssessmentSectionCategoriesOutput + ?? (AssessmentSectionCategoriesOutput = new AssessmentSectionAssemblyCategoryResult[0]); + } + } +} \ No newline at end of file Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/CategoryBoundaries/AssemblyCategoryBoundariesCalculatorStub.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/TestAssemblyToolCalculatorFactory.cs =================================================================== diff -u -rb3257a49b725571baf179cc551d384d762e16942 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/TestAssemblyToolCalculatorFactory.cs (.../TestAssemblyToolCalculatorFactory.cs) (revision b3257a49b725571baf179cc551d384d762e16942) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/TestAssemblyToolCalculatorFactory.cs (.../TestAssemblyToolCalculatorFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -19,11 +19,10 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using Ringtoets.AssemblyTool.Data.Input; using Ringtoets.AssemblyTool.KernelWrapper.Calculators; -using Ringtoets.AssemblyTool.KernelWrapper.Calculators.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; -using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators { @@ -37,17 +36,17 @@ /// public TestAssemblyToolCalculatorFactory() { - LastCreatedAssemblyCategoryBoundariesCalculator = new AssemblyCategoryBoundariesCalculatorStub(); + LastCreatedAssemblyCategoriesCalculator = new AssemblyCategoriesCalculatorStub(); } /// - /// Gets the last created . + /// Gets the last created . /// - public AssemblyCategoryBoundariesCalculatorStub LastCreatedAssemblyCategoryBoundariesCalculator { get; } + public AssemblyCategoriesCalculatorStub LastCreatedAssemblyCategoriesCalculator { get; } - public IAssemblyCategoryBoundariesCalculator CreateAssemblyCategoryBoundariesCalculator(IAssemblyToolKernelFactory factory) + public IAssemblyCategoriesCalculator CreateAssemblyCategoriesCalculator(IAssemblyToolKernelFactory factory) { - return LastCreatedAssemblyCategoryBoundariesCalculator; + return LastCreatedAssemblyCategoriesCalculator; } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Categories/AssemblyCategoriesKernelStub.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Categories/AssemblyCategoriesKernelStub.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Categories/AssemblyCategoriesKernelStub.cs (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -0,0 +1,63 @@ +// 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 AssemblyTool.Kernel; +using AssemblyTool.Kernel.CategoriesOutput; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; + +namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels.Categories +{ + /// + /// Assembly categories kernel stub for testing purposes. + /// + public class AssemblyCategoriesKernelStub : IAssemblyCategoriesKernel + { + /// + /// Gets a value indicating whether was called or not. + /// + public bool Calculated { get; private set; } + + /// + /// Gets the lower boundary norm. + /// + public double LowerBoundaryNorm { get; private set; } + + /// + /// Gets the upper boundary norm. + /// + public double SignalingNorm { get; private set; } + + /// + /// Gets the assessment section categories output. + /// + public CalculationOutput AssessmentSectionCategoriesOutput { get; set; } + + public CalculationOutput Calculate(double signalingNorm, double lowerBoundaryNorm) + { + LowerBoundaryNorm = lowerBoundaryNorm; + SignalingNorm = signalingNorm; + + Calculated = true; + + return AssessmentSectionCategoriesOutput; + } + } +} \ No newline at end of file Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/CategoryBoundaries/AssemblyCategoryBoundariesKernelStub.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/TestAssemblyToolKernelFactory.cs =================================================================== diff -u -r3e27a0f9cddd6e05a755d7f109032be0dc6b8864 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/TestAssemblyToolKernelFactory.cs (.../TestAssemblyToolKernelFactory.cs) (revision 3e27a0f9cddd6e05a755d7f109032be0dc6b8864) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/TestAssemblyToolKernelFactory.cs (.../TestAssemblyToolKernelFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -20,8 +20,8 @@ // All rights reserved. using Ringtoets.AssemblyTool.KernelWrapper.Kernels; -using Ringtoets.AssemblyTool.KernelWrapper.Kernels.CategoryBoundaries; -using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels.CategoryBoundaries; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels.Categories; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels.Categories; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels { @@ -35,17 +35,17 @@ /// public TestAssemblyToolKernelFactory() { - LastCreatedAssemblyCategoryBoundariesKernel = new AssemblyCategoryBoundariesKernelStub(); + LastCreatedAssemblyCategoriesKernel = new AssemblyCategoriesKernelStub(); } /// - /// The last created assembly category boundaries kernel. + /// The last created assembly categories kernel. /// - public AssemblyCategoryBoundariesKernelStub LastCreatedAssemblyCategoryBoundariesKernel { get; } + public AssemblyCategoriesKernelStub LastCreatedAssemblyCategoriesKernel { get; } - public IAssemblyCategoryBoundariesKernel CreateAssemblyCategoryBoundariesKernel() + public IAssemblyCategoriesKernel CreateAssemblyCategoriesKernel() { - return LastCreatedAssemblyCategoryBoundariesKernel; + return LastCreatedAssemblyCategoriesKernel; } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.csproj =================================================================== diff -u -r3e27a0f9cddd6e05a755d7f109032be0dc6b8864 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.TestUtil.csproj) (revision 3e27a0f9cddd6e05a755d7f109032be0dc6b8864) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.TestUtil.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -16,10 +16,10 @@ - + - + Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/AssemblyTool/AssemblyCategoryBoundaries.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Data/AssemblyTool/AssemblyCategoryInput.cs =================================================================== diff -u -r351a1cd039e2455edca83cca064ba3918bc43826 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/Common/src/Ringtoets.Common.Data/AssemblyTool/AssemblyCategoryInput.cs (.../AssemblyCategoryInput.cs) (revision 351a1cd039e2455edca83cca064ba3918bc43826) +++ Ringtoets/Common/src/Ringtoets.Common.Data/AssemblyTool/AssemblyCategoryInput.cs (.../AssemblyCategoryInput.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -22,7 +22,7 @@ namespace Ringtoets.Common.Data.AssemblyTool { /// - /// This class contains all the parameters that are required to perform a category boundaries calculation. + /// This class contains all the parameters that are required to perform an assembly categories calculation. /// public class AssemblyCategoryInput { Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj =================================================================== diff -u -r351a1cd039e2455edca83cca064ba3918bc43826 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 351a1cd039e2455edca83cca064ba3918bc43826) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -16,7 +16,6 @@ - Fisheye: Tag 4160a30705d657946461b76a5c443119cb78d437 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssemblyTool/AssemblyCategoryBoundariesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj =================================================================== diff -u -r351a1cd039e2455edca83cca064ba3918bc43826 -r4160a30705d657946461b76a5c443119cb78d437 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 351a1cd039e2455edca83cca064ba3918bc43826) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 4160a30705d657946461b76a5c443119cb78d437) @@ -20,7 +20,6 @@ -