public void cannot_set_15_doors() { IEnrollmentProvider enrollmentProvider = new DefaultEnrollmentProvider(); IVehicleBuilder builder = new VehicleBuilder(enrollmentProvider); Negassert.mustFail(() => builder.setDoors(15)); }
public void inMemoryVehicleStorage_must_be_empty_on_each_instance() { IVehicle vehicle, motoVehicle; SingleEnrollmentProvider enrollmentProvider = new SingleEnrollmentProvider(); IEqualityComparer <IEnrollment> equalityComparer = new EnrollmentEqualityComparer(); IVehicleBuilder vehicleBuilder = new VehicleBuilder(enrollmentProvider); IVehicleStorage vehicleStorage = new InMemoryVehicleStorage(); vehicleBuilder.addWheel(); vehicleBuilder.addWheel(); vehicleBuilder.setDoors(0); vehicleBuilder.setEngine(40); motoVehicle = vehicleBuilder.build(); Assert.AreEqual(0, vehicleStorage.Count); vehicleStorage.set(motoVehicle); Assert.AreEqual(1, vehicleStorage.Count); vehicle = vehicleStorage.get(enrollmentProvider.DefaultEnrollment); Assert.IsNotNull(vehicle); Assert.IsTrue(equalityComparer.Equals(enrollmentProvider.DefaultEnrollment, vehicle.Enrollment)); vehicleStorage = new InMemoryVehicleStorage(); Assert.AreEqual(0, vehicleStorage.Count); Negassert.mustFail(() => { vehicle = vehicleStorage.get(enrollmentProvider.DefaultEnrollment); }); }
public void WrongBuildRequests_01() { SingleEnrollmentProvider enrollmentProvider = new SingleEnrollmentProvider(); IVehicleBuilder builder = new VehicleBuilder(enrollmentProvider); Negassert.mustFail(() => builder.removeWheel()); builder.addWheel(); builder.addWheel(); builder.addWheel(); builder.addWheel(); Negassert.mustFail(() => builder.setDoors(-27)); builder.setDoors(5); Negassert.mustFail(() => builder.setEngine(-40)); Negassert.mustFail(() => builder.setEngine(0)); builder.setEngine(100); Negassert.mustFail(() => builder.setColor((CarColor)27)); IVehicle vehicle = builder.build(); Negassert.mustFail(() => vehicle.Engine.stop()); vehicle.Engine.start(); Negassert.mustFail(() => vehicle.Engine.start()); Negassert.mustFail(() => vehicle.setWheelsPressure(-1)); Negassert.mustFail(() => vehicle.setWheelsPressure(0)); Negassert.mustFail(() => vehicle.setWheelsPressure(0.99)); Negassert.mustFail(() => vehicle.setWheelsPressure(5.01)); vehicle.setWheelsPressure(2); }
public void engine_horse_power_can_not_be_negative() { IEnrollmentProvider enrollmentProvider = new DefaultEnrollmentProvider(); IVehicleBuilder builder = new VehicleBuilder(enrollmentProvider); Negassert.mustFail(() => builder.setEngine(-70)); }
public void cannot_create_vehicle_without_wheels() { IEnrollmentProvider enrollmentProvider = new DefaultEnrollmentProvider(); IVehicleBuilder builder = new VehicleBuilder(enrollmentProvider); Negassert.mustFail(() => { IVehicle vehicle = builder.build(); }); }
public void cannot_remove_wheel_if_there_are_not_wheels() { IEnrollmentProvider enrollmentProvider = new DefaultEnrollmentProvider(); IVehicleBuilder builder = new VehicleBuilder(enrollmentProvider); builder.addWheel(); builder.addWheel(); builder.removeWheel(); builder.removeWheel(); Negassert.mustFail(() => builder.removeWheel()); }
public void wheel_pressure_can_not_be_negative() { IEnrollmentProvider enrollmentProvider = new DefaultEnrollmentProvider(); IVehicleBuilder builder = new VehicleBuilder(enrollmentProvider); builder.setColor(CarColor.Black); builder.setDoors(4); builder.setEngine(60); builder.addWheel(); builder.addWheel(); IVehicle vehicle = builder.build(); Negassert.mustFail(() => vehicle.setWheelsPressure(-50)); }
public void doors_must_be_between_0_and_6() { IEnrollmentProvider enrollmentProvider = new DefaultEnrollmentProvider(); IVehicleBuilder builder = new VehicleBuilder(enrollmentProvider); for (int i = 0; i < MEDIUM; i++) { int doorsCount = this.random.Next(7, int.MaxValue); Negassert.mustFail(() => builder.setDoors(doorsCount)); } for (int i = 0; i < MEDIUM; i++) { int doorsCount = this.random.Next(int.MinValue, 0); Negassert.mustFail(() => builder.setDoors(doorsCount)); } }
public void Pressure_must_not_be_more_than_5() { IEnrollmentProvider enrollmentProvider = new DefaultEnrollmentProvider(); IVehicleBuilder builder = new VehicleBuilder(enrollmentProvider); builder.setColor(CarColor.Black); builder.setDoors(4); builder.setEngine(60); builder.addWheel(); builder.addWheel(); IVehicle vehicle = builder.build(); Negassert.mustFail(() => vehicle.setWheelsPressure(6)); Negassert.mustFail(() => vehicle.setWheelsPressure(5.01)); Negassert.mustFail(() => vehicle.setWheelsPressure(100)); Negassert.mustFail(() => vehicle.setWheelsPressure(120.01)); }
public void Pressure_must_not_be_less_than_1() // Posible conflicto con el test de JVBB { IEnrollmentProvider enrollmentProvider = new DefaultEnrollmentProvider(); IVehicleBuilder builder = new VehicleBuilder(enrollmentProvider); builder.setColor(CarColor.Black); builder.setDoors(4); builder.setEngine(60); builder.addWheel(); builder.addWheel(); IVehicle vehicle = builder.build(); Negassert.mustFail(() => vehicle.setWheelsPressure(0)); Negassert.mustFail(() => vehicle.setWheelsPressure(0.99)); Negassert.mustFail(() => vehicle.setWheelsPressure(-1)); Negassert.mustFail(() => vehicle.setWheelsPressure(-10.5)); }
public void cannot_openDoor_twice() { SingleEnrollmentProvider enrollmentProvider = new SingleEnrollmentProvider(); IVehicleBuilder builder = new VehicleBuilder(enrollmentProvider); builder.addWheel(); builder.addWheel(); builder.addWheel(); builder.addWheel(); builder.setDoors(2); builder.setEngine(100); builder.setColor(CarColor.Red); IVehicle vehicle = builder.build(); vehicle.Doors[0].open(); Negassert.mustFail(() => vehicle.Doors[0].open()); }