public Car(color farve, int doors, string model, string registrationNo) { if ((doors < 2) || (doors > 5)) { throw new ArgumentException("Dørene skal være en værdi mellem 2 og 5"); } if (model.Equals(null)) { throw new ArgumentException("Modellen skal ikke være null"); } if ((registrationNo.Length < 7) || (registrationNo.Length > 7)) { throw new ArgumentException("RegistrationNr skal have nøjagtige 7 tegn"); } _color = farve; _doors = doors; _model = model; _registrationNo = registrationNo; }
public void RegistrationNoTest() { //Arrange Car.color farve = Car.color.Green; Car nybil = new Car(farve, 9, "Volvo", "GD68214"); }
public void ModelTest() { //Arrange Car.color farve = Car.color.Gray; Car nybil = new Car(farve, 8, null, "AK91345"); }
public void DoorsTest() { //Arrange Car.color farve = Car.color.Black; Car nybil = new Car(farve, 7, "peugeot", "BW81681"); }