public void Read_ValidEntityWithStochasts_ReturnsSubMechanismIllustrationPointWithStochasts() { // Setup var random = new Random(21); var stochastEntityOne = new SubMechanismIllustrationPointStochastEntity { Name = "Stochast", Unit = "-", Alpha = random.NextDouble(), Duration = random.NextDouble(), Realization = random.NextDouble(), Order = 0 }; var stochastEntityTwo = new SubMechanismIllustrationPointStochastEntity { Name = "Stochast_Two", Unit = "m", Alpha = random.NextDouble(), Duration = random.NextDouble(), Realization = random.NextDouble(), Order = 1 }; const string illustrationPointName = "Name"; double beta = random.NextDouble(); var entity = new SubMechanismIllustrationPointEntity { Name = illustrationPointName, Beta = beta, SubMechanismIllustrationPointStochastEntities = new[] { stochastEntityTwo, stochastEntityOne } }; // Call SubMechanismIllustrationPoint illustrationPoint = entity.Read(); // Assert AssertCommonProperties(entity, illustrationPoint); SubMechanismIllustrationPointStochast[] stochasts = illustrationPoint.Stochasts.ToArray(); Assert.AreEqual(2, stochasts.Length); AssertReadStochast(stochastEntityOne, stochasts[0]); AssertReadStochast(stochastEntityTwo, stochasts[1]); }
public void Read_ValidEntityWithoutStochastsAndIllustrationPointResults_ReturnsSubMechanismIllustrationPoint() { // Setup var random = new Random(21); var entity = new SubMechanismIllustrationPointEntity { Name = "Name", Beta = random.NextDouble() }; // Call SubMechanismIllustrationPoint illustrationPoint = entity.Read(); // Assert AssertCommonProperties(entity, illustrationPoint); CollectionAssert.IsEmpty(illustrationPoint.IllustrationPointResults); CollectionAssert.IsEmpty(illustrationPoint.Stochasts); }
public void Read_ValidEntityWithIllustrationPointResults_ReturnsSubMechanismIllustrationPointWithResults() { // Setup var random = new Random(21); var illustrationPointResultEntityOne = new IllustrationPointResultEntity { Description = "Description", Unit = "-", Value = random.NextDouble(), Order = 0 }; var illustrationPointResultEntityTwo = new IllustrationPointResultEntity { Description = "Description_Two", Unit = "m", Value = random.NextDouble(), Order = 1 }; var entity = new SubMechanismIllustrationPointEntity { Name = "Name", Beta = random.NextDouble(), IllustrationPointResultEntities = new[] { illustrationPointResultEntityTwo, illustrationPointResultEntityOne } }; // Call SubMechanismIllustrationPoint illustrationPoint = entity.Read(); // Assert AssertCommonProperties(entity, illustrationPoint); IllustrationPointResult[] illustrationPointResults = illustrationPoint.IllustrationPointResults.ToArray(); Assert.AreEqual(2, illustrationPointResults.Length); AssertReadIllustrationPointResult(illustrationPointResultEntityOne, illustrationPointResults[0]); AssertReadIllustrationPointResult(illustrationPointResultEntityTwo, illustrationPointResults[1]); }