public void ItShouldReturnExpectedValue(RotorCraft rotorCraft)
            {
                engineaddition.Setup(dec => dec.AddTurboshaftEngines(It.IsAny <RotorCraft>())).Returns(() => rotorCraft);
                var somecraft = heavierThanAirAircraftFactory.TryMakeRotorCraft(rotorCraft.SerialNumber, rotorCraft.RotorBlades.ToList(), "singular", 2, 56, "linx", 12000);

                Assert.AreEqual(rotorCraft.ToString(), somecraft.ToString());
            }
            public void ItShouldCallAddTurboshaftEngines(RotorCraft rotorCraft)
            {
                engineaddition.Setup(dec => dec.AddTurboshaftEngines(It.IsAny <RotorCraft>())).Returns((RotorCraft rotorCraftarg) => rotorCraftarg);

                var somecraft = heavierThanAirAircraftFactory.TryMakeRotorCraft(rotorCraft.SerialNumber, rotorCraft.RotorBlades.ToList(), "singular", 2, 56, "linx", 12000);

                engineaddition.Verify(dec => dec.AddTurboshaftEngines(somecraft), Times.Once);
            }
        public RotorCraft TryMakeRotorCraft(string serialnumber, List <RotorBlade> rotorblades, string rotortype = "standart rotor",
                                            int numberofrotors = 1, int fuelcapacity = 0, string manufacturer = "generic aircraft maker",
                                            int maxTOweight    = 1000)
        {
            RotorCraft rotorCraft = new RotorCraft();

            try
            {
                rotorCraft = MakeRotorCraft(serialnumber, rotorblades, rotortype, numberofrotors, fuelcapacity,
                                            manufacturer, maxTOweight);
            }
            catch (ArgumentNullException argumentNullException)
            {
                Console.WriteLine(argumentNullException.Message);
                switch (argumentNullException.ParamName)
                {
                case nameof(rotorblades):
                    rotorblades = new List <RotorBlade>();
                    rotorCraft  = MakeRotorCraft(serialnumber, rotorblades, rotortype, numberofrotors,
                                                 fuelcapacity, manufacturer, maxTOweight);
                    break;

                case nameof(serialnumber):
                    serialnumber = "No serial number specified";
                    rotorCraft   = MakeRotorCraft(serialnumber, rotorblades, rotortype, numberofrotors,
                                                  fuelcapacity, manufacturer, maxTOweight);
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            rotorCraft = AddTurboshaftEngines(rotorCraft);
            Logger.GetLogger().AddToLog(new LogEventArgs(String.Format("new rotorcraft created (SN:{0})", rotorCraft.SerialNumber)));

            //rotorCraft.Subscribe(NTSB.GetInstance());
            AviationAdministration.GetInstance().RegisterAircraft(rotorCraft, rotorCraft.IsOperational);

            return(rotorCraft);
        }
Ejemplo n.º 4
0
 public RotorBlade(bool hassupersonictip, int length, int chord, string materialType)
     : base(length, chord, materialType)
 {
     _parentAircraft = null;
     _hasSupersonicTip = hassupersonictip;
 }
Ejemplo n.º 5
0
 public RotorBlade(bool hassupersonictip, int length, int chord, string materialType) : base(length, chord, materialType)
 {
     _parentAircraft   = null;
     _hasSupersonicTip = hassupersonictip;
 }
 private RotorCraft AddTurboshaftEngines(RotorCraft rotorCraft)
 {
     rotorCraft = turbineEngineInstaller.AddTurboshaftEngines(rotorCraft) as RotorCraft;
     return(rotorCraft);
 }