Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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