using UnitTestSharp; namespace Konis.UnitTests { public class ParticleViewTests : TestFixture { public class CtorTests : TestFixture { public void KeepsEachValue() { var view = new ParticleView(age: 1f, lifeFraction: 0.5f, speed: 3f, random: 0.25f); CheckEqual(1f, view.Age); CheckEqual(0.5f, view.LifeFraction); CheckEqual(3f, view.Speed); CheckEqual(0.25f, view.Random); } } public class OfTests : TestFixture { private static Particle Moving(float age, float lifetime) { return new Particle { Age = age, Lifetime = lifetime, VelocityX = 3, VelocityY = 4, VelocityZ = 12 }; } public void TakesTheAgeAndTheStableNumber() { ParticleView view = ParticleView.Of(Moving(age: 1.5f, lifetime: 3f), random: 0.75f); CheckEqual(1.5f, view.Age); CheckEqual(0.75f, view.Random); } public void SpeedIsTheLengthOfTheVelocity() { CheckEqual(13f, ParticleView.Of(Moving(age: 0f, lifetime: 1f), random: 0f).Speed); } public void LifeFractionIsAgeOverLifetime() { CheckEqual(0.5f, ParticleView.Of(Moving(age: 1.5f, lifetime: 3f), random: 0f).LifeFraction); } public void LifeFractionStopsAtOne() { CheckEqual(1f, ParticleView.Of(Moving(age: 5f, lifetime: 3f), random: 0f).LifeFraction); } public void ALifetimeOfZero_IsAlreadyOver() { CheckEqual(1f, ParticleView.Of(Moving(age: 0f, lifetime: 0f), random: 0f).LifeFraction); } } } }