public void Clone_AllPropertiesSet_ReturnNewInstanceWithCopiedValues() { // Setup StructuresOutput original = CommonTestDataGenerator.GetRandomStructuresOutput(new TestGeneralResultFaultTreeIllustrationPoint()); // Call object clone = original.Clone(); // Assert CoreCloneAssert.AreObjectClones(original, clone, CommonCloneAssert.AreClones); }
public void Clone_NotAllPropertiesSet_ReturnNewInstanceWithCopiedValues() { // Setup StructuresOutput original = CommonTestDataGenerator.GetRandomStructuresOutput(null); // Call object clone = original.Clone(); // Assert CoreCloneAssert.AreObjectClones(original, clone, CommonCloneAssert.AreClones); }
public void Clone_AllPropertiesSet_ReturnsCopiedInstanceWithPropertiesSet() { // Setup StructuresCalculationScenario <TestStructuresInput> original = CreateRandomCalculationScenarioWithoutOutput(); original.Output = CommonTestDataGenerator.GetRandomStructuresOutput(new TestGeneralResultFaultTreeIllustrationPoint()); // Call object clone = original.Clone(); // Assert CoreCloneAssert.AreObjectClones(original, clone, CommonCloneAssert.AreClones <TestStructuresInput, TestStructure>); }
/// <summary> /// This method sets random data values to all properties of <paramref name="input"/>. /// </summary> /// <param name="input">The input to set the random data values to.</param> public static void SetRandomDataToClosingStructuresInput(ClosingStructuresInput input) { var random = new Random(21); input.Structure = new TestClosingStructure(); input.ThresholdHeightOpenWeir = new NormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.ModelFactorSuperCriticalFlow = new NormalDistribution { Mean = random.NextRoundedDouble() }; input.DrainCoefficient = new LogNormalDistribution { Mean = random.NextRoundedDouble() }; input.AreaFlowApertures = new LogNormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.LevelCrestStructureNotClosing = new NormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.InsideWaterLevel = new NormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.FactorStormDurationOpenStructure = random.NextRoundedDouble(); input.FailureProbabilityOpenStructure = random.NextDouble(); input.FailureProbabilityReparation = random.NextDouble(); input.ProbabilityOpenStructureBeforeFlooding = random.NextDouble(); input.DeviationWaveDirection = random.NextRoundedDouble(); input.InflowModelType = random.NextEnumValue <ClosingStructureInflowModelType>(); input.IdenticalApertures = random.Next(); CommonTestDataGenerator.SetRandomDataToStructuresInput(input); }
private static TestStructuresCalculation CreateRandomCalculationWithoutOutput() { var calculation = new TestStructuresCalculation { Comments = { Body = "Random body" }, Name = "Random name" }; CommonTestDataGenerator.SetRandomDataToStructuresInput(calculation.InputParameters); return(calculation); }
public void Clone_Always_ReturnNewInstanceWithCopiedValues() { // Setup var original = new SimpleStructuresInput { Structure = new TestStructure() }; CommonTestDataGenerator.SetRandomDataToStructuresInput(original); // Call object clone = original.Clone(); // Assert CoreCloneAssert.AreObjectClones(original, clone, CommonCloneAssert.AreClones); }
private static StructuresCalculationScenario <TestStructuresInput> CreateRandomCalculationScenarioWithoutOutput() { var random = new Random(21); var calculation = new StructuresCalculationScenario <TestStructuresInput> { Name = "A Name", Comments = { Body = "A comment" }, IsRelevant = random.NextBoolean(), Contribution = random.NextRoundedDouble() }; CommonTestDataGenerator.SetRandomDataToStructuresInput(calculation.InputParameters); return(calculation); }
/// <summary> /// This method sets random data values to all properties of <paramref name="input"/>. /// </summary> /// <param name="input">The input to set the random data values to.</param> public static void SetRandomDataToHeightStructuresInput(HeightStructuresInput input) { var random = new Random(21); input.Structure = new TestHeightStructure(); input.DeviationWaveDirection = random.NextRoundedDouble(); input.ModelFactorSuperCriticalFlow = new NormalDistribution { Mean = random.NextRoundedDouble() }; input.LevelCrestStructure = new NormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; CommonTestDataGenerator.SetRandomDataToStructuresInput(input); }
/// <summary> /// This method sets random data values to all properties of <paramref name="input"/>. /// </summary> /// <param name="input">The input to set the random data values to.</param> public static void SetRandomDataToStabilityPointStructuresInput(StabilityPointStructuresInput input) { var random = new Random(21); input.Structure = new TestStabilityPointStructure(); input.InsideWaterLevelFailureConstruction = new NormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.InsideWaterLevel = new NormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.DrainCoefficient = new LogNormalDistribution { Mean = random.NextRoundedDouble() }; input.LevelCrestStructure = new NormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.ThresholdHeightOpenWeir = new NormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.AreaFlowApertures = new LogNormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.ConstructiveStrengthLinearLoadModel = new VariationCoefficientLogNormalDistribution { Mean = random.NextRoundedDouble(), CoefficientOfVariation = random.NextRoundedDouble() }; input.ConstructiveStrengthQuadraticLoadModel = new VariationCoefficientLogNormalDistribution { Mean = random.NextRoundedDouble(), CoefficientOfVariation = random.NextRoundedDouble() }; input.StabilityLinearLoadModel = new VariationCoefficientLogNormalDistribution { Mean = random.NextRoundedDouble(), CoefficientOfVariation = random.NextRoundedDouble() }; input.StabilityQuadraticLoadModel = new VariationCoefficientLogNormalDistribution { Mean = random.NextRoundedDouble(), CoefficientOfVariation = random.NextRoundedDouble() }; input.FailureCollisionEnergy = new VariationCoefficientLogNormalDistribution { Mean = random.NextRoundedDouble(), CoefficientOfVariation = random.NextRoundedDouble() }; input.ShipMass = new VariationCoefficientNormalDistribution { Mean = random.NextRoundedDouble(), CoefficientOfVariation = random.NextRoundedDouble() }; input.ShipVelocity = new VariationCoefficientNormalDistribution { Mean = random.NextRoundedDouble(), CoefficientOfVariation = random.NextRoundedDouble() }; input.BankWidth = new NormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; input.FlowVelocityStructureClosable = new VariationCoefficientNormalDistribution { Mean = random.NextRoundedDouble() }; input.VolumicWeightWater = random.NextRoundedDouble(); input.FactorStormDurationOpenStructure = random.NextRoundedDouble(); input.EvaluationLevel = random.NextRoundedDouble(); input.VerticalDistance = random.NextRoundedDouble(); input.FailureProbabilityRepairClosure = random.NextDouble(); input.ProbabilityCollisionSecondaryStructure = random.NextDouble(); input.InflowModelType = random.NextEnumValue <StabilityPointStructureInflowModelType>(); input.LoadSchematizationType = random.NextEnumValue <LoadSchematizationType>(); input.LevellingCount = random.Next(); CommonTestDataGenerator.SetRandomDataToStructuresInput(input); }