Skip to content

Instantly share code, notes, and snippets.

@cander
Created April 16, 2025 16:16
Show Gist options
  • Save cander/828ef36689f26ec9773f0b9e3e8cd30b to your computer and use it in GitHub Desktop.
Save cander/828ef36689f26ec9773f0b9e3e8cd30b to your computer and use it in GitHub Desktop.
Unit test re-implementing logic
public void AssignmentExampleTest()
{
// Arrange
var robot = new SquareRobot();
var commands = new int[] { 4, 4, 3, 2, 2, 3 };
// Act
var result = robot.Move(commands);
// Assert
Assert.True(result);
bool answ = false;
for (int i = 0; i < commands.Length; i++)
{
if (i >= 3)
{
if (commands[i] >= commands[i - 2])
{
answ = true;
break;
}
}
}
Assert.True(answ);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment