Esempio n. 1
0
        public void Create_WithValidGeneralSimulationSettingsData_ReturnsExpectedCalculationSettings()
        {
            // Setup
            var random       = new Random(21);
            int failureSpeed = random.Next();

            var settings = new GeneralSimulationSettingsData
            {
                TimeStep = random.NextDouble(),
                MaximumNrOfIterations = random.Next()
            };

            // Call
            CalculationSettings calculationSettings = CalculationSettingsFactory.Create(settings, failureSpeed);

            // Assert
            CalculationSettingsTestHelper.AssertCalculationSettings(settings, failureSpeed, calculationSettings);
        }
        private static void AssertCalculateCall(ICall call,
                                                BalancedFieldLengthCalculation calculation,
                                                int failureVelocity)
        {
            object[] arguments = call.GetArguments();
            AircraftDataTestHelper.AssertAircraftData(calculation.AircraftData,
                                                      calculation.EngineData,
                                                      (KernelAircraftData)arguments[0]);

            Assert.That(arguments[1], Is.TypeOf <EulerIntegrator>());

            GeneralSimulationSettingsData simulationSettings = calculation.SimulationSettings;

            Assert.That(arguments[2], Is.EqualTo(calculation.EngineData.NrOfFailedEngines));
            Assert.That(arguments[3], Is.EqualTo(simulationSettings.Density));
            Assert.That(arguments[4], Is.EqualTo(simulationSettings.GravitationalAcceleration));

            CalculationSettingsTestHelper.AssertCalculationSettings(simulationSettings, failureVelocity,
                                                                    (CalculationSettings)arguments[5]);
        }