public void Runner_GetLapThreeLaps_ReturnValidLap() { //Arrange Runner newRunner = new Runner(); Lap expectedLap = new Lap(4); Lap actualLap; //Act newRunner.AddLap(new Lap(8)); newRunner.AddLap(expectedLap); newRunner.AddLap(new Lap(12)); actualLap = newRunner.GetLap(4); //Assert Assert.AreEqual(expectedLap, actualLap); }
public void Runner_GetLapThreeLaps_ReturnsException() { //Arrange Runner newRunner = new Runner(); Lap actualLap; //Act newRunner.AddLap(new Lap(1)); newRunner.AddLap(new Lap(2)); newRunner.AddLap(new Lap(3)); //Assert try { actualLap = newRunner.GetLap(4); } catch (Exception e) { StringAssert.Contains(e.Message, "Lap was not found"); return; } Assert.Fail("No exception was thrown."); }
public void Runner_GetLapSplitTime_ReturnsSplitTime() { //Arrange TimeSpan expectedTimeSpan = new TimeSpan(0, 1, 20, 15); TimeSpan actualTimeSpan; Runner newRunner = new Runner(); newRunner.AddLap(new Lap(4, ClockType.Split, 1, 20, 15F)); //Act actualTimeSpan = newRunner.GetLap(4).SplitTime; //Assert Assert.AreEqual(expectedTimeSpan, actualTimeSpan); }
public void Runner_AddLapNegative_ReturnsException() { Runner newRunner = new Runner(); try { newRunner.AddLap(new Lap(-1)); } catch (Exception e) { StringAssert.Contains(e.Message, "Laps must be numbered greater than 0"); return; } Assert.Fail("No exception was thrown"); }