public void OpenRace_WitSetRace_ShoulThrowRaceAlreadyExistsException() { IRace race = new Race(this.distance, this.windSpeed, this.oceanCurrenSpeed, this.allowMotorBoats); this.Controller = new BoatSimulatorController(new BoatSimulatorDatabase(), race); this.Controller.OpenRace(this.distance, this.windSpeed, this.oceanCurrenSpeed, this.allowMotorBoats); }
public void SignUpBoat_SignUp_ShouldGetCorrectItem() { this.controller = new BoatSimulatorController(this.fakeData.Object, this.fakeRace.Object); this.controller.SignUpBoat("model"); this.fakeData.Verify(fd => fd.Boats.GetItem("model"), Times.Exactly(1)); }
public void SignUpBoat_WithRaceSet_ShouldAddParticipantToCurrentRace() { this.controller = new BoatSimulatorController(this.fakeData.Object, this.fakeRace.Object); this.controller.SignUpBoat("model"); this.fakeRace.Verify(r => r.AddParticipant(It.IsAny <IBoat>()), Times.Exactly(1)); }
public void SignUpBoat_Success_ShouldReturnSuccessMessage() { this.controller = new BoatSimulatorController(this.fakeData.Object, this.fakeRace.Object); string actual = this.controller.SignUpBoat("model"); string expected = "Boat with model model has signed up for the current Race."; Assert.AreEqual(expected, actual); }
public void SignUp_HavingTheBoatInDatabase_ShouldSignUpSuccessfully() { var repository = new Mock<IRepository<IBoat>>(); repository.Setup(s => s.GetItem("Luxury101")).Returns(new SailBoat("Luxury101", 50, 90)); var database = new Mock<BoatSimulatorDatabase>(); database.SetupGet(m => m.Boats).Returns(repository.Object); IRace race = new Race(this.distance, this.windSpeed, this.oceanCurrenSpeed, this.allowMotorBoats); this.Controller = new BoatSimulatorController(database.Object, race); this.Controller.SignUpBoat("Luxury101"); int participantsCount = this.Controller.CurrentRace.GetParticipants().Count; Assert.AreEqual(1, participantsCount); }
public void SignUpBoat_SignUpMotorBoat_NoMotorBoatsAllowed_ShouldThrow() { this.controller = new BoatSimulatorController(this.fakeData.Object, this.fakeRace.Object); try { this.controller.SignUpBoat("motor1"); } catch (ArgumentException ex) { Assert.AreEqual("The specified boat does not meet the race constraints.", ex.Message); throw; } finally { this.fakeRace.Verify(r => r.AllowsMotorboats, Times.Exactly(1)); } }
public void SignUpBoat_NoSetRace_ShouldThrow() { this.controller = new BoatSimulatorController(this.fakeData.Object, null); try { this.controller.SignUpBoat("model"); } catch (NoSetRaceException ex) { Assert.AreEqual("There is currently no race set.", ex.Message); throw; } finally { Assert.IsNull(this.controller.CurrentRace); } }
public void StartRace_WithoustSetRace_ShoulThrowNoSetRaceException() { this.Controller = new BoatSimulatorController(); this.Controller.StartRace(); }
public void Initialize() { IRace race = new Race(this.distance, this.windSpeed, this.oceanCurrenSpeed, this.allowMotorBoats); this.Controller = new BoatSimulatorController(new BoatSimulatorDatabase(), race); }
public void InitializeTests() { this.controller = new BoatSimulatorController(); }
public void Initialize() { this.Controller = new BoatSimulatorController(); }
public CommandHandler(IBoatSimulatorController controller) { this.Controller = controller; }
public void SignUpBoat_WithRaceSet_ShouldAddParticipantToCurrentRace() { this.controller = new BoatSimulatorController(this.fakeData.Object, this.fakeRace.Object); this.controller.SignUpBoat("model"); this.fakeRace.Verify(r => r.AddParticipant(It.IsAny<IBoat>()), Times.Exactly(1)); }
public void TestInitiliaze() { this.Controller = new BoatSimulatorController(); }