Exemple #1
0
        protected override void Seed(DBContext context)
        {
            base.Seed(context);
            Tyres t = new Tyres()
            {
                Brand = "Dunlop", Country = "Pakistan", Size = "123/12/12", Condition = "new", Quantity = 2, Purchase_Price = 1000.0, Selling_Price = 1500.0
            };
            Sales s = new Sales()
            {
                TyreId = 1, Quantity = 2, CustomerName = "Ali", TransitionDateTime = DateTime.Now.ToString(), CashReceived = 500.0
            };

            context.Tyres.Add(t);
            context.Sales.Add(s);
            context.SaveChanges();
        }
Exemple #2
0
    // Initialisation
    private void Start()
    {
        im     = GetComponent <InputManager>();
        rb     = GetComponent <Rigidbody>();
        ty     = GetComponent <Tyres>();
        engine = GetComponent <Engine>();
        trans  = GetComponent <Transmission>();
        aero   = GetComponent <Aerodynamics>();
        brakes = GetComponent <Brakes>();
        diff   = GetComponent <Differential>();
        steer  = GetComponent <Steering>();
        wheels = GetComponent <Wheels>();

        if (CM)
        {
            rb.centerOfMass = CM.localPosition;
        }
    }
 public CreateStrategyModel(int strategyId, int raceLen, IList <TyreStrategy> strats, IList <Tyre> tyres)
 {
     StrategyId = strategyId;
     RaceLen    = raceLen;
     if (strats != null)
     {
         foreach (var strat in strats)
         {
             StrategyTyres.Add(strat);
         }
     }
     if (tyres != null)
     {
         foreach (var tyre in tyres)
         {
             Tyres.Add(tyre);
         }
     }
 }
    public Car(string model, int engSpeed, int engPower, int cargoWeight, string cargoType,
               double tyre1PS, int tyre1Age, double tyre2PS, int tyre2Age, double tyre3PS, int tyre3Age, double tyre4PS, int tyre4Age)
    {
        this.Model  = model;
        this.Engine = new Engine(engSpeed, engPower);
        this.Cargo  = new Cargo(cargoWeight, cargoType);
        this.Tyres  = new List <Tyre>();

        Tyre firstTyre = new Tyre(tyre1PS, tyre1Age);

        Tyres.Add(firstTyre);
        Tyre secondTyre = new Tyre(tyre2PS, tyre2Age);

        Tyres.Add(secondTyre);
        Tyre thirdTyre = new Tyre(tyre3PS, tyre3Age);

        Tyres.Add(thirdTyre);
        Tyre fourthTyre = new Tyre(tyre4PS, tyre4Age);

        Tyres.Add(fourthTyre);
    }
        public void VehicleAppliesBrakesAndNotifiesDashboardOfCurrentTyrePressureWhenAlarmSounds()
        {
            var vehicleBrakingSystem = new VehicleBrakingSystem();
            var vehicleDashboard     = new VehicleDashboard();

            var tyrePressureAlarmPublisher = new AlarmPublisher();

            tyrePressureAlarmPublisher.RegisterAlarmSubscriber(vehicleBrakingSystem);
            tyrePressureAlarmPublisher.RegisterAlarmSubscriber(vehicleDashboard);

            Tyres tyres = createVehicleTyres();

            TyrePressureSensorManager tyrePressureManager = new TyrePressureSensorManager(tyres, tyrePressureAlarmPublisher);

            tyrePressureManager.MonitorVehicleTyres();

            Assert.IsTrue(vehicleBrakingSystem.EmergencyStop);
            Assert.AreEqual <int>(100, vehicleBrakingSystem.BrakeForceApplied);
            Assert.IsNotNull(vehicleDashboard.messageToUser);
            Assert.IsTrue(vehicleDashboard.makeNoiseAtUser);
        }
        private Tyres createVehicleTyres()
        {
            var tyres = new Tyres();

            tyres.Add("Front DS", new Tyre()
            {
                maxPsi = 40, minPsi = 10
            });
            tyres.Add("Front PS", new Tyre()
            {
                maxPsi = 40, minPsi = 10
            });
            tyres.Add("Rear DS", new Tyre()
            {
                maxPsi = 35, minPsi = 10
            });
            tyres.Add("Rear PS", new Tyre()
            {
                maxPsi = 35, minPsi = 10
            });

            return(tyres);
        }
 public static void Setup(TestContext t)
 {
     tyres = new Tyres();
 }
Exemple #8
0
 public Cars(int hp, double fuelAmount, Tyres tyre)
 {
     this.Hp         = hp;
     this.FuelAmount = fuelAmount;
     this.Tyre       = tyre;
 }
Exemple #9
0
 /// <summary>
 /// Returns if two tyres are equal.
 /// </summary>
 /// <param name="other">The tyre to check for equality.</param>
 /// <returns>True if the tyres are equal.</returns>
 public bool Equals(Tyres other) {
     return this == other;
 }
 /// <summary>
 /// Returns if two tyres are equal.
 /// </summary>
 /// <param name="other">The tyre to check for equality.</param>
 /// <returns>True if the tyres are equal.</returns>
 public bool Equals(Tyres other)
 {
     return(this == other);
 }