public void CorrectGetBrakesByString(string input) { var pilots = new Mock <ICarServices>(); var parts = new Brakes { Name = "Brakes", Price = 100, Speed = 40, Strength = 50, IsDeleted = false, }; pilots.Setup(x => x.GetBrakes(It.IsAny <string>())) .Returns(parts); var result = pilots.Object.GetBrakes(input); var resultName = result.Name; var resultPrice = result.Price; var resultSpeed = result.Speed; var resultId = result.IsDeleted; Assert.Equal(false, resultId); Assert.Equal(40, resultSpeed); Assert.Equal(100, resultPrice); Assert.Equal("Brakes", resultName); }
public static void Run() { Console.WriteLine($"{Environment.NewLine}*** DECORATOR PATTERN ***{Environment.NewLine}"); // Create Some Bikes MountainBike mBike = new MountainBike("Red", 16, 85, 2); mBike.Display(); RoadBike rBike = new RoadBike("Black", 29, 90, true); rBike.Display(); // Now Decorate both the bikes with brakes Brakes mountainBikeWithBrakes = new Brakes(mBike); mountainBikeWithBrakes.AddBrakes(BrakeType.Disc); mountainBikeWithBrakes.Display(); Brakes roadBikeWithBrakes = new Brakes(rBike); roadBikeWithBrakes.AddBrakes(BrakeType.Rim); roadBikeWithBrakes.Display(); // Now Decorate the mountain bike with shocks Shocks mountainBikeWithShocks = new Shocks(mBike); mountainBikeWithShocks.AddShocks(8); mountainBikeWithShocks.Display(); }
public Car() { _engine = new Engine(); _steering = new Steering(); _transmission = new Transmission(); _brakes = new Brakes(); }
public void DescribeCar() { Brakes.Brake(); Engine.Run(); Steering.Steer(); Transmission.Shift(); Wheels.Spin(); }
/// <summary> /// Returns true if DiagnosticProfile instances are equal /// </summary> /// <param name="other">Instance of DiagnosticProfile to be compared</param> /// <returns>Boolean</returns> public bool Equals(DiagnosticProfile other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( LicensePlate == other.LicensePlate || LicensePlate != null && LicensePlate.Equals(other.LicensePlate) ) && ( Engine == other.Engine || Engine != null && Engine.Equals(other.Engine) ) && ( Body == other.Body || Body != null && Body.Equals(other.Body) ) && ( LowVoltage == other.LowVoltage || LowVoltage != null && LowVoltage.Equals(other.LowVoltage) ) && ( Lighting == other.Lighting || Lighting != null && Lighting.Equals(other.Lighting) ) && ( Brakes == other.Brakes || Brakes != null && Brakes.Equals(other.Brakes) ) && ( Sensors == other.Sensors || Sensors != null && Sensors.Equals(other.Sensors) ) && ( Miscellaneous == other.Miscellaneous || Miscellaneous != null && Miscellaneous.SequenceEqual(other.Miscellaneous) ) && ( Conditioning == other.Conditioning || Conditioning != null && Conditioning.Equals(other.Conditioning) )); }
void GetCarComponents() { _carComp = GetComponent <Car>(); _distanceSensorComp = GetComponent <DistanceSensor>(); _followPathComp = GetComponent <FollowPath>(); _brakesComp = GetComponent <Brakes>(); _gasComp = GetComponent <Gas>(); _patienceComp = GetComponent <Patience>(); carData = _carComp.carData; }
//Initialize everything. void Start() { //Make sure the altitude is zeroed startAltitude = transform.position.y; //Get the brake component. In the real program this might //Initialize an object that deals with breaks or something. brake = this.GetComponent <Brakes>(); //Make sure the brakes are off brake.setResistForce(0); //Make sure the brakes are activated. brake.on = true; }
public void BrakesDecorator_AllValidInput_ReturnsInstanceOfBike() { // Arrange MountainBike bike = new MountainBike("Red", 26, 90, 1); // Act Brakes bikeWithBrakes = new Brakes(bike); bikeWithBrakes.AddBrakes(BrakeType.Disc); bikeWithBrakes.Display(); // Assert Assert.IsInstanceOfType(bikeWithBrakes, typeof(Bike)); }
public void ConstructorTest() { Brakes fixedBrakes = new Brakes(); Assert.IsTrue(fixedBrakes.IsFixed()); Brakes broken = new Brakes(true); Assert.IsFalse(broken.IsFixed()); Brakes toBrake = new Brakes(); toBrake.Brake(); Assert.IsFalse(broken.IsFixed()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (LicensePlate != null) { hashCode = hashCode * 59 + LicensePlate.GetHashCode(); } if (Engine != null) { hashCode = hashCode * 59 + Engine.GetHashCode(); } if (Body != null) { hashCode = hashCode * 59 + Body.GetHashCode(); } if (LowVoltage != null) { hashCode = hashCode * 59 + LowVoltage.GetHashCode(); } if (Lighting != null) { hashCode = hashCode * 59 + Lighting.GetHashCode(); } if (Brakes != null) { hashCode = hashCode * 59 + Brakes.GetHashCode(); } if (Sensors != null) { hashCode = hashCode * 59 + Sensors.GetHashCode(); } if (Miscellaneous != null) { hashCode = hashCode * 59 + Miscellaneous.GetHashCode(); } if (Conditioning != null) { hashCode = hashCode * 59 + Conditioning.GetHashCode(); } return(hashCode); } }
// 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 Vehicle(agxSDK.Simulation simulation, Dictionary <string, agx.Hinge> wheelHinges) { m_simulation = simulation; m_wheelHinges = wheelHinges; initVehicleParameters(); initializeDrivetrain(); Clutch.setEfficiency(1.0); Gearbox.setGear(2); m_brakes = new Brakes(); // Initialize the brakes on the wheel hinges foreach (var h in m_wheelHinges) { h.Value.getLock1D().setEnable(false); m_brakes.Add(new Brake(h.Value, m_brakeForceRange)); } }
void Awake() { aeroDynamics = GetComponent <AeroDynamics>(); brakes = GetComponent <Brakes>(); engine = GetComponent <Engine>(); steering = GetComponent <Steering>(); suspension = GetComponent <Suspension>(); transmission = GetComponent <Transmission>(); userInput = GetComponent <UserInput>(); // set the physics clock to 120 Hz Time.fixedDeltaTime = 0.008333f; // Find the wheel colliders and put them in an array // Do not re-order the CD_Colliders in the vehicle model, everything depends on them being RL RR FL FR // WC sequence RL RR FL FR wC = gameObject.GetComponentsInChildren <WheelCollider>(); // Get and configure the vehicle rigidbody rB = GetComponent <Rigidbody>(); rB.mass = mass; rB.centerOfMass = coG; rB.inertiaTensor = inertiaTensor; rB.isKinematic = false; }
/// <summary> /// Initialise a motor object /// </summary> public Motor() { GearValues = new Gear(); BrakeValues = new Brakes(); }
public VehicleModel() { VehicleOverview = new VehicleOverview(); engine = new Engine(); starter = new Starter(); gearBox = new GearBox(); vehGearNum = 0; for (int i = 0; i < subGears.Length; i++) { subGears[i] = new SubGear(); } windForce = new WindForce(); steeringFactor = new SteeringFactor(); steering = new Steering(); fuelTank = new FuelTank(); for (int i = 0; i < otherSteerings.Length; i++) { otherSteerings[i] = new OtherSteering(); } carVibration = new CarVibration(); brakesCommon = new Brakes(); physicsCrashSetting = new PhysicsCrashSetting(); ignoreHeadCollision = false; exhaust = new Exhaust(); roughness = new Roughness(); engineHealth = new EngineHealth(); fuelTankOnCrash = 0; engineParticles = new EngineParticles(); gearboxSettings = new GearboxSettings(); wheels = new Wheel(); body = new Body(); bumper = new Bumper(); windowGlass = new WindowGlass(); light = new Light(); licencePlate = new LicencePlate(); mirror = new Mirror(); wing = new Wing(); door = new Door(); roof = new Roof(); unknown = new Unknown(); engineSoundSet = new EngineSoundSet(); engineSound1 = new EngineSound(); engineSound2 = new EngineSound(); engineSound3 = new EngineSound(); engineSound4 = new EngineSound4(); insideSoundSet = new InsideSoundSet(); carSmallHitType = new CarSmallHitType(); carShortCrashTypeB1 = new CarShortCrashType(); carShortCrashWithGlassTypeC1 = new CarShortCrashType(); unknownSound1 = ""; unknownSound2 = ""; engineStartSound = new EngineStartSound(); engineSoundDriving = new EngineSoundDriving(); for (int i = 0; i < engineSoundOnGears.Length; i++) { engineSoundOnGears[i] = new EngineSoundOnGear(); } engineSoundIdle = new EngineSoundIdle(); wheelSoundWhilePunctured = new WheelSoundWhilePunctured(); carSmallHitType1 = new CarSmallHitType(); carLongCrashType1 = new CarLongCrashType(); carShortCrashWithGlassType1 = new CarShortCrashType(); doorOpenCloseSound = new DoorOpenCloseSound(); insideSoundSet = new InsideSoundSet(); carSmallHitType = new CarSmallHitType(); carLongCrashType2 = new CarLongCrashType(); carShortCrashTypeB1 = new CarShortCrashType(); carShortCrashWithGlassTypeC1 = new CarShortCrashType(); unknownSound1 = ""; unknownSound2 = ""; carShortCrashTypeB2 = new CarShortCrashType(); carShortCrashWithGlassType1 = new CarShortCrashType(); doorOpenCloseSound = new DoorOpenCloseSound(); }