Class ThrowNormalization
- Namespace
- FEFF.TestFixtures.AspNetCore.Randomness
- Assembly
- FEFF.TestFixtures.AspNetCore.dll
A normalization strategy that throws InvalidOperationException when a generated value falls outside the valid range for the target method.
public class ThrowNormalization : INormalizationStrategy
- Inheritance
-
ThrowNormalization
- Implements
- Inherited Members
Remarks
Use this strategy when you want FakeRandom to fail loudly if a configured
FixedNextStrategy<T> produces a value that violates the method contract
(for example, a value greater than or equal to maxValue in Next(int)).
Methods
NormalizeDouble(double)
Normalizes an out-of-range double value to fit within the valid range [0.0, 1.0).
public double NormalizeDouble(double next)
Parameters
nextdoubleThe raw generated value.
Returns
- double
A normalized value that NextDouble() should return.
NormalizeI32(int, int, int)
Normalizes an out-of-range int value to fit within min (inclusive) and max (exclusive).
public int NormalizeI32(int next, int min, int max)
Parameters
nextintThe raw generated value.
minintThe inclusive lower bound of the method contract.
maxintThe exclusive upper bound of the method contract.
Returns
- int
A normalized value that the method should return.
NormalizeI64(long, long, long)
Normalizes an out-of-range long value to fit within min (inclusive) and max (exclusive).
public long NormalizeI64(long next, long min, long max)
Parameters
nextlongThe raw generated value.
minlongThe inclusive lower bound of the method contract.
maxlongThe exclusive upper bound of the method contract.
Returns
- long
A normalized value that the method should return.
NormalizeSingle(float)
Normalizes an out-of-range float value to fit within the valid range [0.0, 1.0).
public float NormalizeSingle(float next)
Parameters
nextfloatThe raw generated value.
Returns
- float
A normalized value that NextSingle() should return.