public void TotalHitPointsShouldReturnCorrectValue() { var part = new EndurancePart("model", 10, 10, 100); IAssembler assembler = new VehicleAssembler(); assembler.AddEndurancePart(part); IVehicle v = new Revenger("revenger", 10, 10, 10, 10, 10, assembler); var expectedVehicleTotal = v.HitPoints + assembler.TotalHitPointModification; var actualVehicleTotal = v.TotalHitPoints; Assert.AreEqual(expectedVehicleTotal, actualVehicleTotal); }
public void ToStringTest() { IPart part = new ArsenalPart("Arsenal", 2, 2, 2); IAssembler assembler = new VehicleAssembler(); assembler.AddArsenalPart(part); assembler.AddArsenalPart(part); assembler.AddEndurancePart(new EndurancePart("22", 22, 22, 22)); assembler.AddShellPart(new ShellPart("ss", 22, 22, 22)); IVehicle vehicle = new Revenger("Revenger", 22, 22, 22, 22, 22, assembler); string actual = vehicle.ToString(); string excpected = "Revenger - Revenger\r\nTotal Weight: 70.000\r\nTotal Price: 70.000\r\nAttack: 26\r\nDefense: 44\r\nHitPoints: 44\r\nParts: None"; Assert.That(() => actual, Is.EqualTo(excpected)); }
public void PartsPropertyShouldReturnCollectionWithAllTypesOfParts() { var part1 = new EndurancePart("model", 10, 10, 10); var part2 = new ShellPart("model", 10, 10, 10); var part3 = new ArsenalPart("model", 10, 10, 10); IAssembler assembler = new VehicleAssembler(); assembler.AddEndurancePart(part1); assembler.AddShellPart(part2); assembler.AddArsenalPart(part3); IVehicle v = new Revenger("revenger", 10, 10, 10, 10, 10, assembler); var expectedCount = 3; var actualCount = v.Parts.Count(); Assert.AreEqual(expectedCount, actualCount); }
public void TestPartsCollection() { IPart part = new ArsenalPart("Arsenal", 2, 2, 2); IAssembler assembler = new VehicleAssembler(); assembler.AddArsenalPart(part); assembler.AddArsenalPart(part); assembler.AddEndurancePart(new EndurancePart("22", 22, 22, 22)); assembler.AddShellPart(new ShellPart("ss", 22, 22, 22)); IVehicle vehicle = new Revenger("Revenger", 22, 22, 22, 22, 22, assembler); int count = 0; foreach (var item in vehicle.Parts) { count++; } Assert.That(() => count, Is.EqualTo(4)); }
public void TestTheTotalProps() { IAssembler assembler = new VehicleAssembler(); assembler.AddArsenalPart(new ArsenalPart("Arsenal", 1, 1, 1)); assembler.AddEndurancePart(new EndurancePart("Endurence", 2, 2, 2)); assembler.AddShellPart(new ShellPart("Shell", 3, 3, 3)); IVehicle revenger = new Revenger("Revenger", 4, 4, 4, 4, 4, assembler); IVehicle vanguard = new Vanguard("Vanguard", 4, 4, 4, 4, 4, assembler); Assert.That(() => revenger.TotalWeight, Is.EqualTo(10)); Assert.That(() => revenger.TotalPrice, Is.EqualTo(10)); Assert.That(() => revenger.TotalHitPoints, Is.EqualTo(6)); Assert.That(() => revenger.TotalDefense, Is.EqualTo(7)); Assert.That(() => revenger.TotalAttack, Is.EqualTo(5)); Assert.That(() => vanguard.TotalWeight, Is.EqualTo(10)); Assert.That(() => vanguard.TotalPrice, Is.EqualTo(10)); Assert.That(() => vanguard.TotalHitPoints, Is.EqualTo(6)); Assert.That(() => vanguard.TotalDefense, Is.EqualTo(7)); Assert.That(() => vanguard.TotalAttack, Is.EqualTo(5)); }