ValueRangeTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Rendering3D.Particles.Tests ValueRangeTests

Namespace: DeltaEngine.Rendering3D.Particles.Tests
Assembly: DeltaEngine.Rendering3D.Particles.Tests (in DeltaEngine.Rendering3D.Particles.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class ValueRangeTests

The ValueRangeTests type exposes the following members.

Constructors

  NameDescription
Public methodValueRangeTests
Initializes a new instance of the ValueRangeTests class
Top
Methods

  NameDescription
Public methodCreateValueRangeFromInvalidStringCrashes
Public methodCreateValueRangeFromString
Public methodGetRandomValue
Public methodMinMaxConstructor
Public methodSetUp
Public methodSingleValueConstructor
Public methodValueRangeToString
Top
Examples

[Test]
public void SingleValueConstructor()
{
    valueRange = new ValueRange(0.1f);
    Assert.AreEqual(0.1f, valueRange.Start);
    Assert.AreEqual(0.1f, valueRange.End);
}
[Test]
public void MinMaxConstructor()
{
    Assert.AreEqual(0.2f, valueRange.Start);
    Assert.AreEqual(0.3f, valueRange.End);
}
[Test]
public void GetRandomValue()
{
    Randomizer.Use(new FixedRandom(new[] { 0.4f }));
    Assert.AreEqual(0.24f, valueRange.GetRandomValue(), 0.0001f);
}
[Test]
public void ValueRangeToString()
{
    Assert.AreEqual("0.2, 0.3", valueRange.ToString());
}
[Test]
public void CreateValueRangeFromString()
{
    var range = new ValueRange("0.1, 0.9");
    Assert.AreEqual(0.1f, range.Start);
    Assert.AreEqual(0.9f, range.End);
}
[Test]
public void CreateValueRangeFromInvalidStringCrashes()
{
    Assert.Throws<FormatException>(() => new ValueRange("abc, 3"));
    Assert.Throws<ValueRange.InvalidStringFormat>(() => new ValueRange("0.1"));
}
See Also