예제 #1
0
        public void Travel_nowhere_in_no_time(double primaryForce, double mass, int delay, double secondaryForce)
        {
            var haggis = new Haggis(primaryForce, mass, delay, secondaryForce);

            var distanceTravelled = haggis.GetDistanceTravelled(0);

            Assert.That(distanceTravelled, Is.EqualTo(0));
        }
예제 #2
0
        public void Travel_at_constant_speed_when_secondary_force_kicks_in_immediately(double primaryForce, double mass, double secondaryForce, int time)
        {
            const int noDelay = 0;
            var       haggis  = new Haggis(primaryForce, mass, noDelay, secondaryForce);

            var distanceTravelled = haggis.GetDistanceTravelled(time);

            var expectedDistance = AccelerationDistance(primaryForce + secondaryForce, mass, time);

            Assert.That(distanceTravelled, Is.EqualTo(expectedDistance));
        }
예제 #3
0
        public void Travel_at_constant_speed_when_no_secondary_force_kicks_in(double primaryForce, double mass, int time)
        {
            var       delay          = time;
            const int secondaryForce = 20;
            var       haggis         = new Haggis(primaryForce, mass, delay, secondaryForce);

            var distanceTravelled = haggis.GetDistanceTravelled(time);

            var expectedDistance = AccelerationDistance(primaryForce, mass, time);

            Assert.That(distanceTravelled, Is.EqualTo(expectedDistance));
        }
예제 #4
0
        public void Speed_up_half_way_through_when_another_force_is_applied(double primaryForce, double mass, int delay, double secondaryForce, int time)
        {
            var haggis = new Haggis(primaryForce, mass, delay, secondaryForce);

            var distanceTravelled = haggis.GetDistanceTravelled(time);

            var primaryDistance    = AccelerationDistance(primaryForce, mass, delay);
            var continuingDistance = Acceleration(primaryForce, mass) * delay * (time - delay);
            var secondaryDistance  = AccelerationDistance(primaryForce + secondaryForce, mass, time - delay);
            var expectedDistance   = primaryDistance + continuingDistance + secondaryDistance;

            Assert.That(distanceTravelled, Is.EqualTo(expectedDistance));
        }