Ejemplo n.º 1
0
        /// <summary>
        /// Calculates this vehicle's total delta-v.
        /// </summary>
        /// <returns>This Vehicle's DeltaV.</returns>
        public virtual double CalculateDeltaV()
        {
            // Assign the value to the "DeltaV" property.
            DeltaV = DeltaVCalculator.CalculateVehicleDeltaV(this);

            return(DeltaV);
        }
        public void CalulateVehicleDeltaVStageNullException()
        {
            //Arrange
            Vehicle vehicle = null;

            //Act
            var actual = DeltaVCalculator.CalculateVehicleDeltaV(vehicle);

            //Assert
            Assert.Fail($"{nameof(vehicle)} was null.");
        }
        public void CalulateVehicleDeltaV()
        {
            //Arrange
            var vehicle = new Vehicle("DeltaV Testing");

            #region Stages

            var stageOne = new Stage()
            {
                DryMass         = 250,
                WetMass         = 650,
                SpecificImpulse = 302
            };

            var stageTwo = new Stage()
            {
                DryMass         = 500,
                WetMass         = 1200,
                SpecificImpulse = 332
            };

            var stageThree = new Stage()
            {
                DryMass         = 2200,
                WetMass         = 7000,
                SpecificImpulse = 348
            };

            #endregion

            vehicle.StageInfo.Add(1, stageOne);
            vehicle.StageInfo.Add(2, stageTwo);
            vehicle.StageInfo.Add(3, stageThree);

            var expected = 7045.45946876031;
            //Act
            var actual = DeltaVCalculator.CalculateVehicleDeltaV(vehicle);

            //Assert
            Assert.AreEqual(expected, actual, 0.0000000001);
        }