public void Constructor_ValidArguments_ExpectedValues() { // Setup var source = new TestTopLevelIllustrationPoint(); const string windDirectionName = "Name"; const string closingSituation = "Closing situation"; const int nrOfDecimals = 10; var beta = new RoundedDouble(nrOfDecimals, 123.789); var controlItem = new IllustrationPointControlItem(source, windDirectionName, closingSituation, Enumerable.Empty <Stochast>(), beta); // Call var row = new IllustrationPointRow(controlItem); // Assert TestHelper.AssertTypeConverter <IllustrationPointRow, NoProbabilityValueDoubleConverter>( nameof(IllustrationPointRow.Probability)); TestHelper.AssertTypeConverter <IllustrationPointRow, NoValueRoundedDoubleConverter>( nameof(IllustrationPointRow.Reliability)); double expectedProbability = StatisticsConverter.ReliabilityToProbability(controlItem.Beta); Assert.AreSame(controlItem, row.IllustrationPointControlItem); Assert.AreEqual(controlItem.WindDirectionName, row.WindDirection); Assert.AreEqual(controlItem.ClosingSituation, row.ClosingSituation); Assert.AreEqual(expectedProbability, row.Probability); Assert.AreEqual(beta, row.Reliability); Assert.AreEqual(nrOfDecimals, row.Reliability.NumberOfDecimalPlaces); }
public void Constructor_ValidArguments_ReturnsExpectedProperties() { // Setup const string windDirectionName = "Wind direction name"; const string closingSituation = "Closing situation"; const int nrOfDecimals = 10; var beta = new RoundedDouble(nrOfDecimals, 13.37); var source = new TestTopLevelIllustrationPoint(); IEnumerable <Stochast> stochasts = Enumerable.Empty <Stochast>(); // Call var item = new IllustrationPointControlItem(source, windDirectionName, closingSituation, stochasts, beta); // Assert Assert.AreSame(source, item.Source); Assert.AreEqual(nrOfDecimals, item.Beta.NumberOfDecimalPlaces); Assert.AreEqual(beta, item.Beta, item.Beta.GetAccuracy()); Assert.AreSame(stochasts, item.Stochasts); }
private static IEnumerable <Tuple <string, RoundedDouble> > GetStochastValues(IllustrationPointControlItem illustrationPointControlItem) { return(illustrationPointControlItem.Stochasts .Select(stochast => Tuple.Create(stochast.Name, new RoundedDouble(5, Math.Pow(stochast.Alpha, 2)))) .ToArray()); }
protected override object GetSelectedTopLevelIllustrationPoint(IllustrationPointControlItem selection) { return(selection.Source); }