public void Clone()
        {
            var e = new AngularVelocityEffector
              {
            AngleParameter = "A",
            SpeedParameter = "S",
            Enabled = false,
              };

              var c = (AngularVelocityEffector)e.Clone();

              Assert.AreEqual(e.AngleParameter, c.AngleParameter);
              Assert.AreEqual(e.SpeedParameter, c.SpeedParameter);
              Assert.AreEqual(e.Enabled, c.Enabled);
        }
        public void Test0()
        {
            var ps = new ParticleSystem();
              var angle = ps.Parameters.AddUniform<float>("A");
              var speed = ps.Parameters.AddUniform<float>("S");

              angle.DefaultValue = 3;
              speed.DefaultValue = 2;

              var e = new AngularVelocityEffector
              {
            ParticleSystem = ps,
            AngleParameter = "A",
            SpeedParameter = "S",
              };

              e.RequeryParameters();
              e.Initialize();

              var dt = new TimeSpan(0, 0, 0, 1);
              e.BeginUpdate(dt);
              e.UpdateParticles(dt, 10, 20);
              e.EndUpdate(dt);

              Assert.AreEqual(5, angle.DefaultValue);

              e.BeginUpdate(dt);
              e.UpdateParticles(dt, 10, 20);
              e.EndUpdate(dt);

              Assert.AreEqual(7 % ConstantsF.TwoPi, angle.DefaultValue);

              speed.DefaultValue = -17;

              e.BeginUpdate(dt);
              e.UpdateParticles(dt, 10, 20);
              e.EndUpdate(dt);

              Assert.IsTrue(Numeric.AreEqual(-10 + 2 * ConstantsF.TwoPi, angle.DefaultValue));
        }
 public void DefaultValues()
 {
     var e = new AngularVelocityEffector();
       Assert.AreEqual(ParticleParameterNames.Angle, e.AngleParameter);
       Assert.AreEqual(ParticleParameterNames.AngularSpeed, e.SpeedParameter);
 }
        public void WrongParameters()
        {
            var ps = new ParticleSystem();
              ps.Parameters.AddUniform<float>("A");
              ps.Parameters.AddUniform<float>("S");

              var e = new AngularVelocityEffector { ParticleSystem = ps };

              var dt = new TimeSpan(0, 0, 0, 1);

              // There should be no exception.
              e.RequeryParameters();
              e.Initialize();
              e.BeginUpdate(dt);
              e.UpdateParticles(dt, 10, 20);
              e.EndUpdate(dt);

              e.Uninitialize();
        }
        public void Uninitialize()
        {
            var ps = new ParticleSystem();
              var wp0 = new WeakReference(ps.Parameters.AddVarying<float>(ParticleParameterNames.Angle));
              var wp1 = new WeakReference(ps.Parameters.AddVarying<float>(ParticleParameterNames.AngularSpeed));

              var e = new AngularVelocityEffector { ParticleSystem = ps };

              e.RequeryParameters();
              e.Uninitialize();

              e.ParticleSystem = null;
              ps = null;

              GC.Collect();
              GC.WaitForFullGCComplete();

              Assert.IsFalse(wp0.IsAlive);
              Assert.IsFalse(wp1.IsAlive);
        }