public void DriverConstructorThrowException() { UnitCar car = new UnitCar("CZ", 100, 5.5); Assert.That(() => new UnitDriver(null, car), Throws.ArgumentNullException); }
public void Is_Calculate_Average_Horse_Power_Returns_Correct_Result( string model, int horsePower, double cubicCentimeters, string model1, int horsePower1, double cubicCentimeters1, string model2, int horsePower2, double cubicCentimeters2, string name, string name1, string name2) { //Arrange UnitCar unitCar = new UnitCar(model, horsePower, cubicCentimeters); UnitCar unitCar1 = new UnitCar(model1, horsePower1, cubicCentimeters1); UnitCar unitCar2 = new UnitCar(model2, horsePower2, cubicCentimeters2); UnitDriver unitDriver = new UnitDriver(name, unitCar); UnitDriver unitDriver1 = new UnitDriver(name1, unitCar1); UnitDriver unitDriver2 = new UnitDriver(name2, unitCar2); //Act RaceEntry raceEntry = new RaceEntry(); raceEntry.AddDriver(unitDriver); raceEntry.AddDriver(unitDriver1); raceEntry.AddDriver(unitDriver2); //Assert Double expectedResult = (double)(horsePower + horsePower1 + horsePower2) / 3; Assert.AreEqual(expectedResult, raceEntry.CalculateAverageHorsePower()); }
public void DriverCreatedWhenDataIsValidShouldWork(string name) { var validCar = new UnitCar("BMW", 100, 250); var driver = new UnitDriver(name, validCar); Assert.AreEqual(name, driver.Name); }
public void Setup() { this.raceEntry = new RaceEntry(); this.unitCar = new UnitCar("Test", 1, 1); this.unitDriver = new UnitDriver("Test", unitCar); this.fakeUnitDriver = new UnitDriver("Does Not Exist", unitCar); }
public void DriverCreatedWhenNameIsInvalidShouldThrow(string name) { var validCar = new UnitCar("BMW", 100, 250); Assert.Throws <ArgumentNullException>(() => new UnitDriver(name, validCar)) .Message.Equals("Name cannot be null!"); }
public void CountShouldBeZeroWhenCreatingEmptyRaceEntry() { var validCar = new UnitCar("BMW", 100, 250); var raceEntry = new RaceEntry(); Assert.AreEqual(0, raceEntry.Counter); }
public void Setup() { this.unitCar = new UnitCar("Opel", 90, 1400); this.unitDriver = new UnitDriver("Pesho", this.unitCar); this.raceEntry = new RaceEntry(); }
public void Setup() { dict = new Dictionary <string, UnitDriver>(); car = new UnitCar("Bokol", 100, 1000); driver = new UnitDriver("Koko", car); re = new RaceEntry(); }
public void DriverConstructorTest() { UnitCar car = new UnitCar("CZ", 100, 5.5); UnitDriver driver = new UnitDriver("A", car); Assert.That(driver.Name, Is.EqualTo("A")); Assert.That(driver.Car, Is.EqualTo(car)); }
public void Setup() { car = new UnitCar("XXX", 200, 200); firstDriver = new UnitDriver("AAA", car); secondDriver = new UnitDriver("BBB", car); race = new RaceEntry(); }
public void Setup() { this.race = new RaceEntry(); this.driver = new Dictionary <string, UnitDriver>(); this.unitCar = new UnitCar(Model, HorsePower, CubicCentimeters); this.unitDriver = new UnitDriver(Name, unitCar); }
public void Setup() { raceEntry = new RaceEntry(); car = new UnitCar("Nissan GT-R", 600, 3800); driver = new UnitDriver("n1claren", car); }
public void Setup() { this.unitCar = new UnitCar("OP", 100, 100); this.unitDriver = new UnitDriver("Pesho", unitCar); this.unitDriver1 = new UnitDriver("Niki", unitCar); this.raceEntry = new RaceEntry(); }
public void UniDriverCtorNotWork() { Assert.Throws <ArgumentNullException>(() => { UnitCar car = new UnitCar("golf", 100, 2000); UnitDriver driver = new UnitDriver(null, car); }); }
public void UniDriverCtorWork() { UnitCar car = new UnitCar("golf", 100, 2000); UnitDriver driver = new UnitDriver("gosho", car); Assert.AreEqual("gosho", driver.Name); Assert.AreEqual(car, driver.Car); }
public void UniCarCtorWork() { UnitCar car = new UnitCar("golf", 100, 2000); Assert.AreEqual("golf", car.Model); Assert.AreEqual(100, car.HorsePower); Assert.AreEqual(2000, car.CubicCentimeters); }
public void AddDriver_ThrowsException_WhenDriverExists() { UnitCar car = new UnitCar("Model", 100, 500); UnitDriver driver = new UnitDriver("Name", car); raceEntry.AddDriver(driver); Assert.Throws <InvalidOperationException>(() => raceEntry.AddDriver(driver)); }
public void NameShouldWork() { UnitCar unitCar = new UnitCar("Unit", 150, 2000.0d); UnitDriver unitDriver = new UnitDriver("Driver", unitCar); Assert.AreEqual("Driver", unitDriver.Name); }
public void TestConstructorOfUnitCar() { UnitCar car = new UnitCar("bmw", 200, 20.5); Assert.AreEqual("bmw", car.Model); Assert.AreEqual(200, car.HorsePower); Assert.AreEqual(20.5, car.CubicCentimeters); }
public void CalculateAverageHorsePower_ThrowsException_WhenDriversAreLessThanMinimum() { UnitCar car = new UnitCar("Model", 100, 500); UnitDriver driver = new UnitDriver("Name", car); raceEntry.AddDriver(driver); Assert.Throws <InvalidOperationException>(() => raceEntry.CalculateAverageHorsePower()); }
public void AddDriver_IncreasesCount_WhenDriverIsValid() { UnitCar car = new UnitCar("Model", 100, 500); UnitDriver driver = new UnitDriver("Name", car); raceEntry.AddDriver(driver); Assert.That(raceEntry.Counter, Is.EqualTo(1)); }
public void Setup() { testCar = new UnitCar("Testy", 100, 250.50); testDriver = new UnitDriver("Bo", testCar); testEntry = new RaceEntry(); }
public void NullName() { UnitCar car = new UnitCar("model", 3000, 250); //UnitDriver driver = new UnitDriver(null, car); Assert.Throws <ArgumentNullException>(() => new UnitDriver(null, car)); }
public void ConstructorShouldWork() { UnitCar unitCar = new UnitCar("Unit", 150, 2000.0d); Assert.AreEqual("Unit", unitCar.Model); Assert.AreEqual(150, unitCar.HorsePower); Assert.AreEqual(2000.0, unitCar.CubicCentimeters); }
public void CarConstructorTest() { UnitCar car = new UnitCar("CZ", 100, 5.5); Assert.That(car.Model, Is.EqualTo("CZ")); Assert.That(car.HorsePower, Is.EqualTo(100)); Assert.That(car.CubicCentimeters, Is.EqualTo(5.5)); }
public void Is_Name_Null_Should_Throw_Null_Argument_Exception(string model, int horsePower, double cubicCentimeters, string name) { //Arrange - Act UnitCar unitCar = new UnitCar(model, horsePower, cubicCentimeters); //Assert Assert.Throws <ArgumentNullException>(() => new UnitDriver(name, unitCar)); }
public void UnitCar_Set_With_Incorrect_Values_NO_Throw() { UnitCar testIncorrect = new UnitCar(" ", -5000, 0); Assert.AreEqual(testIncorrect.Model, " "); Assert.AreEqual(testIncorrect.HorsePower, -5000); Assert.AreEqual(testIncorrect.CubicCentimeters, 0); }
public void ShouldSetCorrectly_WhenAddDriver() { var car = new UnitCar("model", 100, 1000); var driver = new UnitDriver("Sena", car); race.AddDriver(driver); Assert.That(driver.Name, Is.EqualTo("Sena")); }
public void TestConstructorUnitCarShouldCreateCarCorectly() { UnitCar car = new UnitCar("A", 10, 10.5); Assert.AreEqual("A", car.Model); Assert.AreEqual(10, car.HorsePower); Assert.AreEqual(10.5, car.CubicCentimeters); }
public void Calculate_ThrowException_OneParticipants() { var name = "ivan"; var car = new UnitCar("model", 10, 10); UnitDriver driver = new UnitDriver(name, car); race.AddDriver(driver); Assert.Throws <InvalidOperationException>(() => race.CalculateAverageHorsePower()); }