public void GetValidAngleOfAttack_VariousAerodynamicsData_ReturnsExpectedValue(AerodynamicsData data, Angle expectedAngle) { // Call Angle angleOfAttack = AerodynamicsDataTestHelper.GetValidAngleOfAttack(data); // Assert Assert.AreEqual(expectedAngle, angleOfAttack); }
public void GetValidAngleOfAttack_AerodynamicsDataNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => AerodynamicsDataTestHelper.GetValidAngleOfAttack(null); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("data", exception.ParamName); }
public static void Calculate_Always_ReturnsExpectedZeroPitchRate() { // Setup var random = new Random(21); AircraftData aircraftData = AircraftDataTestFactory.CreateRandomAircraftData(); Angle angleOfAttack = AerodynamicsDataTestHelper.GetValidAngleOfAttack(aircraftData.AerodynamicsData); var aircraftState = new AircraftState(angleOfAttack, new Angle(), random.NextDouble(), random.NextDouble(), random.NextDouble()); var calculator = new AbortedTakeOffDynamicsCalculator(aircraftData, random.NextDouble(), random.NextDouble()); // Call AircraftAccelerations accelerations = calculator.Calculate(aircraftState); // Assert Assert.Zero(accelerations.PitchRate.Radians); }
public static void Calculate_Always_SendsCorrectInput() { // Setup var random = new Random(21); AircraftData aircraftData = AircraftDataTestFactory.CreateRandomAircraftData(); var calculator = new TestTakeOffDynamicsCalculator(aircraftData, random.NextDouble(), random.NextDouble()); Angle angleOfAttack = AerodynamicsDataTestHelper.GetValidAngleOfAttack(aircraftData.AerodynamicsData); var state = new AircraftState(angleOfAttack, new Angle(), random.NextDouble(), random.NextDouble(), random.NextDouble()); // Call calculator.Calculate(state); // Assert Assert.AreSame(state, calculator.CalculateDragInput); }
public static void Calculate_WithAircraftStateAlways_ReturnsExpectedClimbRate() { // Setup var random = new Random(21); AircraftData aircraftData = AircraftDataTestFactory.CreateRandomAircraftData(); Angle angleOfAttack = AerodynamicsDataTestHelper.GetValidAngleOfAttack(aircraftData.AerodynamicsData); var aircraftState = new AircraftState(angleOfAttack, new Angle(), random.NextDouble(), random.NextDouble(), random.NextDouble()); var calculator = new TestTakeOffDynamicsCalculator(aircraftData, random.NextDouble(), random.NextDouble()); // Call AircraftAccelerations accelerations = calculator.Calculate(aircraftState); // Assert double expectedClimbRate = aircraftState.TrueAirspeed * Math.Sin(aircraftState.FlightPathAngle.Radians); Assert.AreEqual(expectedClimbRate, accelerations.ClimbRate, tolerance); }
public static void Calculate_WithAirspeedLowerThanThreshold_ReturnsExpectedZeroRate() { // Setup var random = new Random(21); AircraftData aircraftData = AircraftDataTestFactory.CreateRandomAircraftData(); Angle angleOfAttack = AerodynamicsDataTestHelper.GetValidAngleOfAttack(aircraftData.AerodynamicsData); var aircraftState = new AircraftState(angleOfAttack, new Angle(), random.NextDouble(), random.NextDouble(), random.NextDouble()); // Precondition Assert.IsTrue(aircraftState.TrueAirspeed < 1); var calculator = new TestTakeOffDynamicsCalculator(aircraftData, random.NextDouble(), random.NextDouble()); // Call AircraftAccelerations accelerations = calculator.Calculate(aircraftState); // Assert Assert.Zero(accelerations.FlightPathRate.Degrees); }