Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test "Robot_names_are_unique" incorrect #1562

Closed
HugoRoss opened this issue Aug 6, 2021 · 2 comments
Closed

Test "Robot_names_are_unique" incorrect #1562

HugoRoss opened this issue Aug 6, 2021 · 2 comments

Comments

@HugoRoss
Copy link
Contributor

HugoRoss commented Aug 6, 2021

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.

HugoRoss added a commit to HugoRoss/csharp that referenced this issue Aug 6, 2021
…" to keep a reference to each generated robot.
@davyzhu
Copy link

davyzhu commented Aug 24, 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.

ErikSchierboom added a commit that referenced this issue Sep 16, 2021
* 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>
@ErikSchierboom
Copy link
Member

Closed by #1563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants