You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the wording of the exercise we learn that only all existing robots must be unique: "Your solution must ensure that
every existing robot has a unique name." But the test does not keep a reference to the created robots, allowing them to be garbage collected instantly, resulting in an incorrect fail of the test if the ID is reused.
Suggested solution:
Create a List and add each created robot to it.
The text was updated successfully, but these errors were encountered:
HugoRoss
added a commit
to HugoRoss/csharp
that referenced
this issue
Aug 6, 2021
The test case is correct.
Use a static member (HashSet) in Robot class, and initialize it by a static constructor. Every Robot object will share that static member.
* Issue 1562 (#1562): Correct unit test "Robot_names_are_unique" to keep a reference to each generated robot.
* Update exercises/practice/robot-name/RobotNameTests.cs
* Update exercises/practice/robot-name/RobotNameTests.cs
Co-authored-by: Erik Schierboom <erik_schierboom@hotmail.com>
From the wording of the exercise we learn that only all existing robots must be unique: "Your solution must ensure that
every existing robot has a unique name." But the test does not keep a reference to the created robots, allowing them to be garbage collected instantly, resulting in an incorrect fail of the test if the ID is reused.
Suggested solution:
Create a List and add each created robot to it.
The text was updated successfully, but these errors were encountered: