public void Robots_Filter_NotMatchingFilter_ShouldReturnNone() { Robots robots = new Robots(); Drone dron = new Drone("Drone", 10.5, 100.5); Mower mower = new Mower("Mower", 6.3, 1.2, 250); DrivingRobot funCar = new DrivingRobot("FunCar", 33.5, 55.5); bool ok = robots.AddRobot(mower); ok = robots.AddRobot(dron); ok = robots.AddRobot(funCar); Robot[] filteredRobots = robots.GetByFilter("Terminator"); Assert.AreEqual(0, filteredRobots.Length, "Länge des Arrays stimmt nicht"); }
public void Robots_Filter_UpperCase_ShouldReturnCorrectResult() { Robots robots = new Robots(); Drone dron = new Drone("Drone", 10.5, 100.5); Mower mower = new Mower("Mower", 6.3, 1.2, 250); DrivingRobot funCar = new DrivingRobot("FunCar", 33.5, 55.5); bool ok = robots.AddRobot(mower); ok = robots.AddRobot(dron); ok = robots.AddRobot(funCar); Robot[] filteredRobots = robots.GetByFilter("MOWER"); Assert.AreEqual(1, filteredRobots.Length, "Länge des Arrays stimmt nicht"); Assert.AreEqual("Mower", filteredRobots[0].Name, "Name des gefilterten Roboters stimmt nicht"); }
public void Robots_Filter_EmptyFilter_ShouldReturnAll() { Robots robots = new Robots(); Drone dron = new Drone("Drone", 10.5, 100.5); Mower mower = new Mower("Mower", 6.3, 1.2, 250); DrivingRobot funCar = new DrivingRobot("FunCar", 33.5, 55.5); bool ok = robots.AddRobot(mower); ok = robots.AddRobot(dron); ok = robots.AddRobot(funCar); Robot[] filteredRobots = robots.GetByFilter(""); Assert.AreEqual(3, filteredRobots.Length, "Länge des Arrays stimmt nicht"); Assert.AreEqual("FunCar", filteredRobots[0].Name, "Roboter an Position 0 wurde falsch zurückgegeben"); Assert.AreEqual("Drone", filteredRobots[1].Name, "Roboter an Position 1 wurde falsch zurückgegeben"); Assert.AreEqual("Mower", filteredRobots[2].Name, "Roboter an Position 2 wurde falsch zurückgegeben"); }