public void NumbersOfCarsGenerated_ShouldBeZero() { //Arrange Road road = new RoadType1(new Point(0, 0), new PictureBox()); //Act // Nothing to do here //Assert Assert.AreEqual(0, road.CarsOnRoad); }
public void NumbersOfCarsGenerated_ShouldBeEqualToAmount() { //Arrange Road road = new RoadType1(new Point(0, 0), new PictureBox()); int amount = 5; //Act road.AddCars(road.Lanes[0], amount); int sumOfCarsOnThisRoadLanes = 0; foreach (Lane L in road.Lanes) { sumOfCarsOnThisRoadLanes += L.Cars.Count; } //Assert // Roads should have the amount specified, and the sum of all cars on that road lanes should be that amount too Assert.AreEqual(amount, road.CarsOnRoad); Assert.AreEqual(amount, sumOfCarsOnThisRoadLanes); }
public void CheckIfAllThePointsOnGridAreReturned_ShouldGiveAllLanesPairedWithPoints() { // Arrange Grid myGrid = new Grid(3, 3); Road testRoad = new RoadType1(new Point(0, 0), new PictureBox()); myGrid.AddRoad(testRoad, 0); // Act Dictionary <Lane, List <Point> > allPoints = myGrid.GetAllPointsOnGrid(); int pointSum = 0; foreach (KeyValuePair <Lane, List <Point> > kvp in allPoints) { foreach (Point P in kvp.Value) { pointSum += 1; } } //Assert // Note: RoadType 1 have 12 lanes, with 1 starting point each Assert.AreEqual(12, allPoints.Count); Assert.AreEqual(12, pointSum); }