public void Convert_ValidArguments_ExpectedProperties() { // Setup var random = new Random(21); var hydraRingWindDirection = new HydraRingWindDirection("Name", random.NextDouble()); var hydraRingWindDirectionClosingSituation = new HydraRingWindDirectionClosingSituation(hydraRingWindDirection, "closing scenario"); var hydraRingIllustrationPointResult = new HydraRingIllustrationPointResult("HydraIllustrationPointResult", "-", random.NextDouble()); var hydraRingSubMechanismIllustrationPointStochast = new HydraRingSubMechanismIllustrationPointStochast("HydraSubMechanismIllustrationPointStochast", "-", random.NextDouble(), random.NextDouble(), random.NextDouble()); var hydraRingSubMechanismIllustrationPoint = new HydraRingSubMechanismIllustrationPoint("name", new[] { hydraRingSubMechanismIllustrationPointStochast }, new[] { hydraRingIllustrationPointResult }, random.NextDouble()); // Call TopLevelSubMechanismIllustrationPoint combination = TopLevelSubMechanismIllustrationPointConverter.Convert( hydraRingWindDirectionClosingSituation, hydraRingSubMechanismIllustrationPoint); // Assert WindDirection windDirection = combination.WindDirection; Assert.AreEqual(hydraRingWindDirection.Angle, windDirection.Angle, windDirection.Angle.GetAccuracy()); Assert.AreEqual(hydraRingWindDirection.Name, windDirection.Name); Assert.AreEqual(hydraRingWindDirectionClosingSituation.ClosingSituation, combination.ClosingSituation); SubMechanismIllustrationPoint subMechanismIllustrationPoint = combination.SubMechanismIllustrationPoint; Assert.AreEqual(hydraRingSubMechanismIllustrationPoint.Beta, subMechanismIllustrationPoint.Beta, subMechanismIllustrationPoint.Beta.GetAccuracy()); Assert.AreEqual(hydraRingSubMechanismIllustrationPoint.Name, subMechanismIllustrationPoint.Name); IllustrationPointResult illustrationPointResult = subMechanismIllustrationPoint.IllustrationPointResults.Single(); Assert.AreEqual(hydraRingIllustrationPointResult.Description, illustrationPointResult.Description); Assert.AreEqual(hydraRingIllustrationPointResult.Value, illustrationPointResult.Value, illustrationPointResult.Value.GetAccuracy()); SubMechanismIllustrationPointStochast stochast = subMechanismIllustrationPoint.Stochasts.Single(); Assert.AreEqual(hydraRingSubMechanismIllustrationPointStochast.Alpha, stochast.Alpha, stochast.Alpha.GetAccuracy()); Assert.AreEqual(hydraRingSubMechanismIllustrationPointStochast.Duration, stochast.Duration, stochast.Duration.GetAccuracy()); Assert.AreEqual(hydraRingSubMechanismIllustrationPointStochast.Name, stochast.Name); Assert.AreEqual(hydraRingSubMechanismIllustrationPointStochast.Unit, stochast.Unit); Assert.AreEqual(hydraRingSubMechanismIllustrationPointStochast.Realization, stochast.Realization, stochast.Realization.GetAccuracy()); }
/// <summary> /// Creates a new instance of <see cref="IllustrationPointResult"/> based on the information /// of <paramref name="hydraRingIllustrationPointResult"/>. /// </summary> /// <param name="hydraRingIllustrationPointResult">The <see cref="HydraRingIllustrationPointResult"/> /// to base the <see cref="IllustrationPointResult"/> to create on.</param> /// <returns>The newly created <see cref="IllustrationPointResult"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="hydraRingIllustrationPointResult"/> /// is <c>null</c>.</exception> public static IllustrationPointResult Convert(HydraRingIllustrationPointResult hydraRingIllustrationPointResult) { if (hydraRingIllustrationPointResult == null) { throw new ArgumentNullException(nameof(hydraRingIllustrationPointResult)); } return(new IllustrationPointResult(hydraRingIllustrationPointResult.Description, hydraRingIllustrationPointResult.Unit, hydraRingIllustrationPointResult.Value)); }
public void Convert_ValidArguments_ExpectedProperties() { // Setup var random = new Random(21); var hydraRingIllustrationPointResult = new HydraRingIllustrationPointResult("Description", "-", random.NextDouble()); // Call IllustrationPointResult illustrationPointResult = IllustrationPointResultConverter.Convert(hydraRingIllustrationPointResult); // Assert Assert.AreEqual(illustrationPointResult.Description, illustrationPointResult.Description); Assert.AreEqual(illustrationPointResult.Unit, illustrationPointResult.Unit); Assert.AreEqual(illustrationPointResult.Value, illustrationPointResult.Value, illustrationPointResult.Value.GetAccuracy()); }
public void Convert_ValidArguments_ExpectedProperties() { // Setup var random = new Random(21); var hydraIllustrationPointResult = new HydraRingIllustrationPointResult("HydraIllustrationPointResult", "-", random.NextDouble()); const string name = "hydraRingSubMechanismIllustrationPointStochast"; const string unit = "-"; double alpha = random.NextDouble(); double duration = random.NextDouble(); double realization = random.NextDouble(); var hydraRingSubMechanismIllustrationPointStochast = new HydraRingSubMechanismIllustrationPointStochast(name, unit, duration, alpha, realization); double beta = random.NextDouble(); var hydraSubMechanismIllustrationPoint = new HydraRingSubMechanismIllustrationPoint("name", new[] { hydraRingSubMechanismIllustrationPointStochast }, new[] { hydraIllustrationPointResult }, beta); // Call SubMechanismIllustrationPoint subMechanismIllustrationPoint = SubMechanismIllustrationPointConverter.Convert(hydraSubMechanismIllustrationPoint); // Assert Assert.AreEqual(subMechanismIllustrationPoint.Beta, subMechanismIllustrationPoint.Beta, subMechanismIllustrationPoint.Beta.GetAccuracy()); Assert.AreEqual(subMechanismIllustrationPoint.Name, subMechanismIllustrationPoint.Name); IllustrationPointResult illustrationPointResult = subMechanismIllustrationPoint.IllustrationPointResults.Single(); Assert.AreEqual(hydraIllustrationPointResult.Description, illustrationPointResult.Description); Assert.AreEqual(hydraIllustrationPointResult.Value, illustrationPointResult.Value, illustrationPointResult.Value.GetAccuracy()); SubMechanismIllustrationPointStochast stochast = subMechanismIllustrationPoint.Stochasts.Single(); Assert.AreEqual(hydraRingSubMechanismIllustrationPointStochast.Alpha, stochast.Alpha, stochast.Alpha.GetAccuracy()); Assert.AreEqual(hydraRingSubMechanismIllustrationPointStochast.Duration, stochast.Duration, stochast.Duration.GetAccuracy()); Assert.AreEqual(hydraRingSubMechanismIllustrationPointStochast.Name, stochast.Name); Assert.AreEqual(hydraRingSubMechanismIllustrationPointStochast.Unit, stochast.Unit); Assert.AreEqual(hydraRingSubMechanismIllustrationPointStochast.Realization, stochast.Realization, stochast.Realization.GetAccuracy()); }