Skip to content

Commit

Permalink
Add tests to reproduce the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
msevestre committed Apr 30, 2023
1 parent 7d62887 commit 7bada56
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override double CalculateValueFromPercentile(double percentile, IUsingFor
{
return percentile >= 0.5 ? Mean(refObject) : 0;
}

public override double ProbabilityDensityFor(double value, IUsingFormula refObject)
{
return value == Mean(refObject) ? 1 : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,33 @@ public void distributed_parameter_should_return_correct_value()
}
}

public class When_updating_the_value_of_a_discrete_distribution_mean_parameter : concern_for_DistributionFormulaFactory
{
protected DiscreteDistributionFormula _discreteDistribution;
protected IParameter _meanParam;

protected override void Context()
{
base.Context();
_meanParam = new Parameter().WithName(Constants.Distribution.MEAN).WithDimension(_dim).WithValue(0.43);
_distributedParam.Add(_meanParam);
_discreteDistribution = sut.CreateDiscreteDistributionFormulaFor(_distributedParam, _meanParam);
_distributedParam.Formula = _discreteDistribution;
}

protected override void Because()
{
_meanParam.Value = 0.43 * 0.92;
_distributedParam.IsFixedValue = false;
}

[Observation]
public void distributed_parameter_should_return_correct_value()
{
_distributedParam.Value.ShouldBeEqualTo(0.43 * 0.92);
}
}

public class When_creating_lognormal_distribution : concern_for_DistributionFormulaFactory
{
protected LogNormalDistributionFormula _logNormalDistribution;
Expand Down

0 comments on commit 7bada56

Please sign in to comment.