Skip to content

Instantly share code, notes, and snippets.

@cameronpresley
Created May 12, 2020 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cameronpresley/8b71ed90bcab7e9b5ba91fc19b438627 to your computer and use it in GitHub Desktop.
Save cameronpresley/8b71ed90bcab7e9b5ba91fc19b438627 to your computer and use it in GitHub Desktop.
Mars Rover - Moving Forward Example
using NUnit;
using System;
namespace MarsRover.UnitTests.RoverTests
{
[TestFixture]
public class WhenMovingForward()
{
[Test]
public void AndFacingNorthThenYIncreasesByOne()
{
// Arrange
var rover = new Rover { Orientation = Direction.North };
var initialLocation = rover.Location;
// Act
rover.MoveForward();
// Assert
var expectedLocation = new Coordinate {X=initialLocation.X, Y=initialLocation.Y+1};
Assert.AreEqual(expectedLocation, initialLocation);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment